Browse Source

Fix a bug by revert GetCNodeTarget() for Load

pull/13848/head
He Wei 5 years ago
parent
commit
0769193185
2 changed files with 4 additions and 2 deletions
  1. +4
    -0
      mindspore/ccsrc/pipeline/jit/static_analysis/auto_monad.cc
  2. +0
    -2
      mindspore/core/ir/anf.cc

+ 4
- 0
mindspore/ccsrc/pipeline/jit/static_analysis/auto_monad.cc View File

@@ -1221,9 +1221,13 @@ class AutoMonadConverter {
}

CNodePtr MakeLoad(const CNodePtr &cnode, const AnfNodePtr &ref, const AnfNodePtr &u) {
static const std::string primitive_target = "primitive_target";
// Create Load cnode.
auto load_prim = NewValueNode(prim::kPrimLoad);
auto load_cnode = func_graph_->NewCNode({load_prim, ref, u});
// Set device target for Load CNode.
std::string target = GetCNodeTarget(cnode);
load_cnode->set_user_data(primitive_target, std::make_shared<std::string>(target));
// Set load_cnode abstract to Tensor according the input Ref[Tensor].
auto ref_abs = dyn_cast<abstract::AbstractRef>(ref->abstract());
MS_EXCEPTION_IF_NULL(ref_abs);


+ 0
- 2
mindspore/core/ir/anf.cc View File

@@ -454,8 +454,6 @@ std::string GetCNodeTarget(const AnfNodePtr &node) {
if (inputs.size() == 3 && !IsPrimitiveCNode(inputs[1], prim::kPrimMakeTuple)) {
return GetCNodeTarget(inputs[1]);
}
} else if (IsPrimitiveCNode(node, prim::kPrimLoad)) {
return GetCNodeTarget(cnode->input(1));
} else if (IsPrimitiveCNode(node, prim::kPrimMakeTuple)) {
return GetMaketupleNodeTarget(cnode);
} else if (IsPrimitiveCNode(node, prim::kPrimTupleGetItem)) {


Loading…
Cancel
Save