diff --git a/onnxruntime/core/graph/graph.cc b/onnxruntime/core/graph/graph.cc index d489a59c4b798..c633895996dda 100644 --- a/onnxruntime/core/graph/graph.cc +++ b/onnxruntime/core/graph/graph.cc @@ -2539,14 +2539,14 @@ Status Graph::VerifyNodeAndOpMatch(const ResolveOptions& options) { // Node verification. auto& node = *GetNode(node_index); - NodeProto node_proto; - node.ToProto(node_proto); const auto& node_name = node.Name(); if (!node.Op()) { { auto status = Status::OK(); ORT_TRY { + NodeProto node_proto; + node.ToProto(node_proto); checker::check_node(node_proto, ctx, lsc); } ORT_CATCH(const std::exception& ex) { @@ -2619,8 +2619,8 @@ Status Graph::VerifyNodeAndOpMatch(const ResolveOptions& options) { NO_CHANGE_ON_SYNC_FLAG(ORT_RETURN_IF_ERROR(InferAndVerifyTypeMatch(node, *p_op, options))); // Accumulate output names of the iterated Node - for (auto& output_name : node_proto.output()) { - lsc.output_names.insert(output_name); + for (const auto& output : node.OutputDefs()) { + lsc.output_names.insert(output->Name()); } }