diff --git a/mindspore/ccsrc/pipeline/pynative/base.h b/mindspore/ccsrc/pipeline/pynative/base.h index ed218e2193..a55d2a4d86 100644 --- a/mindspore/ccsrc/pipeline/pynative/base.h +++ b/mindspore/ccsrc/pipeline/pynative/base.h @@ -66,7 +66,7 @@ struct OpExecInfo { }; using OpExecInfoPtr = std::shared_ptr; -const std::set ignore_infer_prim = {"make_ref", "mixed_precision_cast"}; +const std::set ignore_infer_prim = {"mixed_precision_cast"}; const std::set force_infer_prim = {"TopK", "DropoutGenMask"}; const std::set ignore_judge_dynamic_cell = { "Cell mindspore.nn.layer.basic.Dense", "Cell mindspore.nn.probability.distribution.normal.Normal", diff --git a/mindspore/ops/operations/other_ops.py b/mindspore/ops/operations/other_ops.py index 568e87ce5e..2e9130a833 100644 --- a/mindspore/ops/operations/other_ops.py +++ b/mindspore/ops/operations/other_ops.py @@ -361,11 +361,14 @@ class MakeRefKey(Primitive): ``Ascend`` ``GPU`` ``CPU`` Examples: - >>> from mindspore.ops import functional as ops + >>> import numpy as np + >>> from mindspore import Parameter, Tensor + >>> from mindspore import dtype as mstype + >>> import mindspore.ops as ops >>> class Net(nn.Cell): ... def __init__(self): ... super(Net, self).__init__() - ... self.y = mindspore.Parameter(Tensor(np.ones([6, 8, 10]), mindspore.int32), name="y") + ... self.y = Parameter(Tensor(np.ones([6, 8, 10]), mstype.int32), name="y") ... self.make_ref_key = ops.MakeRefKey("y") ... ... def construct(self, x): @@ -373,7 +376,7 @@ class MakeRefKey(Primitive): ... ref = ops.make_ref(key, x, self.y) ... return ref * x ... - >>> x = Tensor(np.ones([3, 4, 5]), mindspore.int32) + >>> x = Tensor(np.ones([3, 4, 5]), mstype.int32) >>> net = Net() >>> output = net(x) >>> print(output)