Bugfix in GraphKernel after all integer ValueNodes are changed to int64

From: @dayschan
Reviewed-by: @gaoxiong1,@ckey_dou
Signed-off-by: @ckey_dou
pull/8317/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit 255c4b4b5a

@ -75,7 +75,7 @@ class CNodeDecoder {
std::string value = attr_json[kJsonKeyValue];
return MakeValue(value);
} else if (type == "int") {
int value = attr_json[kJsonKeyValue];
int64_t value = attr_json[kJsonKeyValue];
return MakeValue(value);
} else if (type == "bool") {
bool value = attr_json[kJsonKeyValue];
@ -84,7 +84,7 @@ class CNodeDecoder {
float value = attr_json[kJsonKeyValue];
return MakeValue(value);
} else if (type == "listInt") {
std::vector<int> value = attr_json[kJsonKeyValue];
std::vector<int64_t> value = attr_json[kJsonKeyValue];
return MakeValue(value);
} else if (type == "listStr") {
std::vector<std::string> value = attr_json[kJsonKeyValue];

@ -513,8 +513,8 @@ void ReplaceNewFuseCNode(const FuncGraphPtr &func_graph, const AnfNodePtr &new_f
MS_EXCEPTION_IF_NULL(value_input);
auto value_node = value_input->cast<ValueNodePtr>();
MS_EXCEPTION_IF_NULL(value_node);
int item_idx = GetValue<int>(value_node->value());
int new_item_idx = SizeToLong(out_idx) + offset + item_idx;
auto item_idx = GetValue<int64_t>(value_node->value());
int64_t new_item_idx = SizeToLong(out_idx) + offset + item_idx;
fn_inputs.clear();
fn_inputs.push_back(NewValueNode(prim::kPrimTupleGetItem));
fn_inputs.push_back(new_fuse_cnode);

@ -272,7 +272,7 @@ class AreaGraph {
size_t input_area = node_area_map_[input_node];
// if the input node is in a tuple, then we need to create a GetItem fot it.
if (node_index_in_returned_tuple_.count(input_node) != 0) {
int idx_val = SizeToLong(node_index_in_returned_tuple_[input_node]);
auto idx_val = SizeToLong(node_index_in_returned_tuple_[input_node]);
auto idx = NewValueNode(idx_val);
idx->set_abstract(std::make_shared<abstract::AbstractScalar>(idx_val));
AnfNodePtrList getitem_inputs = {NewValueNode(prim::kPrimTupleGetItem), main_cnodes[input_area], idx};

Loading…
Cancel
Save