From 7a08907f74dc3798619b507ba86ca0c5a59f2e22 Mon Sep 17 00:00:00 2001 From: han-jian27 <15895851726@139.com> Date: Fri, 26 Aug 2022 10:45:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E6=9E=90onnx=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=AD=A4=E7=AB=8Bconst=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parser/onnx/onnx_parser.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/parser/onnx/onnx_parser.cc b/parser/onnx/onnx_parser.cc index 0f88ab3..dc5bf09 100644 --- a/parser/onnx/onnx_parser.cc +++ b/parser/onnx/onnx_parser.cc @@ -671,13 +671,12 @@ Status OnnxModelParser::ParseAllNodeProto(ge::onnx::GraphProto &onnx_graph, ge:: } Status OnnxModelParser::GetGraphInputs(ge::onnx::GraphProto &onnx_graph, std::vector &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_) {