Commit 4285d37d authored by Paul's avatar Paul
Browse files

Avoid double add for onnx nodes

parent 2b697563
...@@ -685,7 +685,8 @@ struct onnx_parser ...@@ -685,7 +685,8 @@ struct onnx_parser
} }
for(auto&& p : nodes) for(auto&& p : nodes)
{ {
this->parse_node(get_name(p.second)); for (auto&& output : p.second.output())
this->parse_node(output);
} }
} }
...@@ -701,7 +702,6 @@ struct onnx_parser ...@@ -701,7 +702,6 @@ struct onnx_parser
{ {
if(nodes.count(input) > 0) if(nodes.count(input) > 0)
{ {
// auto&& iname = get_name(nodes.at(input));
assert(name != input); assert(name != input);
this->parse_node(input); this->parse_node(input);
args.push_back(instructions.at(input)); args.push_back(instructions.at(input));
...@@ -720,12 +720,13 @@ struct onnx_parser ...@@ -720,12 +720,13 @@ struct onnx_parser
{ {
result = ops[node.op_type()](get_attributes(node), args); result = ops[node.op_type()](get_attributes(node), args);
} }
std::transform(node.output().begin(), assert(node.output().size() >= result.size());
node.output().end(), std::transform(result.begin(),
result.begin(), result.end(),
node.output().begin(),
std::inserter(instructions, instructions.end()), std::inserter(instructions, instructions.end()),
[](auto&& onnx_out, auto&& parse_out) { [](auto&& x, auto&& y) {
return std::make_pair(onnx_out, parse_out); return std::make_pair(y, x);
}); });
} }
} }
...@@ -758,7 +759,6 @@ struct onnx_parser ...@@ -758,7 +759,6 @@ struct onnx_parser
std::unordered_map<std::string, onnx::NodeProto> result; std::unordered_map<std::string, onnx::NodeProto> result;
for(auto&& node : graph.node()) for(auto&& node : graph.node())
{ {
result[get_name(node)] = node;
for(auto&& output : node.output()) for(auto&& output : node.output())
{ {
result[output] = node; result[output] = node;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment