Browse Source

Bugfix in GraphKernel after all integer ValueNodes are changed to int64

tags/v1.1.0
dayschan 5 years ago
parent
commit
f8be2f972b
3 changed files with 5 additions and 5 deletions
  1. +2
    -2
      mindspore/ccsrc/backend/kernel_compiler/akg/akg_kernel_json_decoder.cc
  2. +2
    -2
      mindspore/ccsrc/backend/optimizer/graph_kernel/graph_kernel_helper.cc
  3. +1
    -1
      mindspore/ccsrc/backend/optimizer/graph_kernel/graph_kernel_splitter.cc

+ 2
- 2
mindspore/ccsrc/backend/kernel_compiler/akg/akg_kernel_json_decoder.cc View File

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


+ 2
- 2
mindspore/ccsrc/backend/optimizer/graph_kernel/graph_kernel_helper.cc View File

@@ -513,8 +513,8 @@ void ReplaceNewFuseCNode(const FuncGraphPtr &func_graph, const AnfNodePtr &new_f
MS_EXCEPTION_IF_NULL(value_input); MS_EXCEPTION_IF_NULL(value_input);
auto value_node = value_input->cast<ValueNodePtr>(); auto value_node = value_input->cast<ValueNodePtr>();
MS_EXCEPTION_IF_NULL(value_node); 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.clear();
fn_inputs.push_back(NewValueNode(prim::kPrimTupleGetItem)); fn_inputs.push_back(NewValueNode(prim::kPrimTupleGetItem));
fn_inputs.push_back(new_fuse_cnode); fn_inputs.push_back(new_fuse_cnode);


+ 1
- 1
mindspore/ccsrc/backend/optimizer/graph_kernel/graph_kernel_splitter.cc View File

@@ -272,7 +272,7 @@ class AreaGraph {
size_t input_area = node_area_map_[input_node]; 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 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) { 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); auto idx = NewValueNode(idx_val);
idx->set_abstract(std::make_shared<abstract::AbstractScalar>(idx_val)); idx->set_abstract(std::make_shared<abstract::AbstractScalar>(idx_val));
AnfNodePtrList getitem_inputs = {NewValueNode(prim::kPrimTupleGetItem), main_cnodes[input_area], idx}; AnfNodePtrList getitem_inputs = {NewValueNode(prim::kPrimTupleGetItem), main_cnodes[input_area], idx};


Loading…
Cancel
Save