From a3b08a88c260172b1856b15f8bf1419302d556fd Mon Sep 17 00:00:00 2001 From: y00500818 Date: Mon, 22 Feb 2021 15:30:12 +0800 Subject: [PATCH] bugfix for onnx data index seting --- parser/onnx/onnx_parser.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parser/onnx/onnx_parser.cc b/parser/onnx/onnx_parser.cc index 742b419..866d6b6 100644 --- a/parser/onnx/onnx_parser.cc +++ b/parser/onnx/onnx_parser.cc @@ -159,6 +159,7 @@ Status OnnxModelParser::ParseInput(ge::onnx::GraphProto &onnx_graph, } // get input value info map + int64_t data_index = 0; for (int i = 0; i < onnx_graph.input_size(); i++) { ge::onnx::ValueInfoProto value_info = onnx_graph.input(i); GELOGI("The index of %d input name : %s.", i, value_info.name().c_str()); @@ -201,7 +202,7 @@ Status OnnxModelParser::ParseInput(ge::onnx::GraphProto &onnx_graph, // add index ge::onnx::AttributeProto *attribute_index = input_node->add_attribute(); attribute_index->set_name(ge::kAttrNameIndex); - attribute_index->set_i(i); + attribute_index->set_i(data_index++); input_node_names_.emplace_back(value_info.name()); } return SUCCESS;