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_) {