Fix a bug by revert GetCNodeTarget() for Load

pull/13848/head
He Wei 4 years ago
parent bf7c1049dc
commit 0769193185

@ -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);

@ -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