Browse Source

!12041 unify parameter output type

From: @zhangbuxue
Reviewed-by: @ginfung,@zh_qh
Signed-off-by: @zh_qh
tags/v1.2.0-rc1
mindspore-ci-bot Gitee 5 years ago
parent
commit
e6221008a1
5 changed files with 6 additions and 5 deletions
  1. +1
    -1
      mindspore/ccsrc/pipeline/jit/static_analysis/program_specialize.cc
  2. +1
    -1
      mindspore/common/parameter.py
  3. +1
    -0
      mindspore/core/abstract/prim_others.cc
  4. +2
    -2
      mindspore/ops/operations/math_ops.py
  5. +1
    -1
      mindspore/ops/operations/other_ops.py

+ 1
- 1
mindspore/ccsrc/pipeline/jit/static_analysis/program_specialize.cc View File

@@ -544,7 +544,7 @@ void FuncGraphSpecializer::ProcessCNode(const CNodePtr &new_node) {
}

if (CanSpecializeNode(func)) {
// for primitive node , we build the primitive node with inferred attributes in the first pass
// for primitive node, we build the primitive node with inferred attributes in the first pass
// so we do not build replaced node again here in second pass
if (IsValueNode<Primitive>(func)) {
new_inputs[0] = func;


+ 1
- 1
mindspore/common/parameter.py View File

@@ -105,7 +105,7 @@ class Parameter(Tensor_):
>>> print(net(x))
[[2.]]
>>> net.weight.set_data(Tensor(np.zeros((1,2))))
Parameter (name=w)
Parameter (name=w, shape=(1, 2), dtype=Float64, requires_grad=True)
>>> print(net(x))
[[0.]]
"""


+ 1
- 0
mindspore/core/abstract/prim_others.cc View File

@@ -168,6 +168,7 @@ AbstractBasePtr InferImplDepend(const AnalysisEnginePtr &, const PrimitivePtr &p
MS_LOG(EXCEPTION) << primitive->name() << " input args size should be at lest 1, but got 0";
}
auto depends = args_spec_list[0]->Broaden();
// For scalar, need to set value to kAnyValue, because broaden scalar will not change the value.
if (depends->isa<AbstractScalar>()) {
depends->set_value(kAnyValue);
}


+ 2
- 2
mindspore/ops/operations/math_ops.py View File

@@ -218,7 +218,7 @@ class AssignAdd(PrimitiveWithInfer):
>>> value = Tensor(np.ones([1]).astype(np.int64)*100)
>>> output = net(value)
>>> print(output)
Parameter (name=global_step)
Parameter (name=global_step, shape=(1,), dtype=Int64, requires_grad=True)
"""
__mindspore_signature__ = (
sig.make_sig('x', sig.sig_rw.RW_WRITE, dtype=sig.sig_dtype.T),
@@ -273,7 +273,7 @@ class AssignSub(PrimitiveWithInfer):
>>> value = Tensor(np.ones([1]).astype(np.int32)*100)
>>> output = net(value)
>>> print(output)
Parameter (name=global_step)
Parameter (name=global_step, shape=(1,), dtype=Int32, requires_grad=True)
"""

__mindspore_signature__ = (


+ 1
- 1
mindspore/ops/operations/other_ops.py View File

@@ -54,7 +54,7 @@ class Assign(PrimitiveWithCheck):
>>> net = Net()
>>> output = net(x)
>>> print(output)
Parameter (name=y)
Parameter (name=y, shape=(1,), dtype=Float32, requires_grad=True)
"""
__mindspore_signature__ = (
sig.make_sig('variable', sig.sig_rw.RW_WRITE, dtype=sig.sig_dtype.T),


Loading…
Cancel
Save