Browse Source

解析onnx模型中的孤立const节点

pull/634/head
han-jian27 3 years ago
parent
commit
7a08907f74
1 changed files with 6 additions and 7 deletions
  1. +6
    -7
      parser/onnx/onnx_parser.cc

+ 6
- 7
parser/onnx/onnx_parser.cc View File

@@ -671,13 +671,12 @@ Status OnnxModelParser::ParseAllNodeProto(ge::onnx::GraphProto &onnx_graph, ge::
}

Status OnnxModelParser::GetGraphInputs(ge::onnx::GraphProto &onnx_graph, std::vector<ge::Operator> &input_ops) {
if (input_node_names_.empty()) {
// subgraph might not have input, we use constant nodes as the start nodes of graph
for (int i = 0; i < onnx_graph.node_size(); i++) {
ge::onnx::NodeProto *node = onnx_graph.mutable_node(i);
if (node->op_type() == kOpTypeConstant) {
input_node_names_.emplace_back(node->name());
}
// subgraph might not have input, or isolated const nodes exist in the graph,
// we use constant nodes as the start nodes of graph
for (int i = 0; i < onnx_graph.node_size(); i++) {
ge::onnx::NodeProto *node = onnx_graph.mutable_node(i);
if (node->op_type() == kOpTypeConstant) {
input_node_names_.emplace_back(node->name());
}
}
for (auto in_name : input_node_names_) {


Loading…
Cancel
Save