npu dyshape

This commit is contained in:
greatpan 2022-07-07 18:10:43 +08:00
parent 3334a4efef
commit e9a00aa921
6 changed files with 18 additions and 8 deletions

View File

@ -1060,9 +1060,9 @@ mindspore.Tensor
**异常:**
- **TypeError** - 如果 `keep_dims` 不是bool类型
- **TypeError** - 如果 `x` 不是Tensor类型
- **TypeError** - 如果 `axis` 不是以下数据类型之一int、tuple 或 list。
- **TypeError** - 如果 `x` 不是Tensor类型。
.. py:method:: ptp(axis=None, keepdims=False)

View File

@ -39,6 +39,7 @@ ConstInputToAttrInfoRegistry::ConstInputToAttrInfoRegistry() {
Register(prim::kPrimReshape->name(), {1});
Register(prim::kPrimReduceMax->name(), {1});
Register(prim::kPrimReduceMin->name(), {1});
Register(prim::kPrimReduceProd->name(), {1});
Register(prim::kPrimReduceSum->name(), {1});
Register(prim::kPrimArgminV2->name(), {1});
Register(prim::kPrimReduceMean->name(), {1});

View File

@ -25,9 +25,6 @@ RER_ASCEND_DYNAMIC_CONST_TO_ATTR(kEmbeddingLookupOpName, 2, 3, 4, 5);
RER_ASCEND_DYNAMIC_CONST_TO_ATTR(kExpandDimsOpName, 1);
RER_ASCEND_DYNAMIC_CONST_TO_ATTR(kReduceAllOpName, 1);
RER_ASCEND_DYNAMIC_CONST_TO_ATTR(kReduceAnyOpName, 1);
RER_ASCEND_DYNAMIC_CONST_TO_ATTR(kReduceMaxOpName, 1);
RER_ASCEND_DYNAMIC_CONST_TO_ATTR(kReduceMeanOpName, 1);
RER_ASCEND_DYNAMIC_CONST_TO_ATTR(kReduceMinOpName, 1);
RER_ASCEND_DYNAMIC_CONST_TO_ATTR(kTransposeOpName, 1);
RER_ASCEND_STATIC_CONST_TO_ATTR(kApplyRMSPropOpname, 5, 6, 7);

View File

@ -36,6 +36,9 @@
#include "ops/strided_slice.h"
#include "ops/reduce_sum.h"
#include "ops/reduce_mean.h"
#include "ops/reduce_min.h"
#include "ops/reduce_max.h"
#include "ops/reduce_prod.h"
#include "abstract/abstract_function.h"
#include "abstract/ops/infer_functions.h"
#include "utils/ms_context.h"
@ -154,6 +157,10 @@ PrimShapeDependMap &GetHostDependsMap() {
{kDynamicBroadcastTo, ShapeSet{1}},
{kNonDeterministicInts, ShapeSet{0}},
{prim::kPrimReduceSum->name(), ShapeSet{1}},
{prim::kPrimReduceMean->name(), ShapeSet{1}},
{prim::kPrimReduceMax->name(), ShapeSet{1}},
{prim::kPrimReduceMin->name(), ShapeSet{1}},
{prim::kPrimReduceProd->name(), ShapeSet{1}},
{prim::kPrimArgminV2->name(), ShapeSet{1}},
{kAffineGrid, ShapeSet{1}},
{prim::kPrimInplaceUpdateV2->name(), ShapeSet{1}},
@ -363,10 +370,11 @@ PrimitiveEvalImplMap &GetPrimitiveToBackendEvalImplMap() {
{prim::kPrimReciprocal, R{ops::ReciprocalInfer, nullptr, true}},
{prim::kPrimReduceSum, R{ops::ReduceSumInfer, nullptr, true}},
{prim::kPrimReduceMean, R{ops::ReduceMeanInfer, nullptr, true}},
{prim::kPrimReduceProd, R{ops::ReduceProdInfer, nullptr, true}},
{prim::kPrimReduceAll, R{InferImplReduceFunc, nullptr, true}},
{prim::kPrimReduceAny, R{InferImplReduceFunc, nullptr, true}},
{prim::kPrimReduceMax, R{InferImplReduceFunc, nullptr, true}},
{prim::kPrimReduceMin, R{InferImplReduceFunc, nullptr, true}},
{prim::kPrimReduceMax, R{ops::ReduceMaxInfer, nullptr, true}},
{prim::kPrimReduceMin, R{ops::ReduceMinInfer, nullptr, true}},
{prim::kPrimBiasAddGrad, R{InferImplBiasAddGrad, nullptr, true}},
{prim::kPrimReduceScatter, R{InferImplReduceScatter, nullptr, true}},
{prim::kPrimCast, R{InferImplCast, nullptr, true}},

View File

@ -1423,6 +1423,10 @@ class Tensor(Tensor_):
Returns:
Tensor, has the same data type as input tensor.
Raises:
TypeError: If `axis` is not one of the following: int, tuple or list.
TypeError: If `keep_dims` is not a bool.
Supported Platforms:
``Ascend`` ``GPU`` ``CPU``

View File

@ -19,7 +19,7 @@ from mindspore.ops.op_info_register import op_info_register, TBERegOp, DataType
reduce_mean_op_info = TBERegOp("ReduceMean") \
.fusion_type("OPAQUE") \
.async_flag(False) \
.binfile_name("reduce_mean.so") \
.binfile_name("reduce_mean_d.so") \
.compute_cost(10) \
.kernel_name("reduce_mean_d") \
.partial_flag(True) \