Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions onnxruntime/core/graph/graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4277,6 +4277,16 @@ bool Graph::AddControlEdge(NodeIndex src_node_index, NodeIndex dst_node_index) {

const ONNX_NAMESPACE::GraphProto& Graph::ToGraphProto() {
if (!GraphProtoSyncNeeded()) {
for (int tensor_idx = 0; tensor_idx < graph_proto_->initializer_size(); ++tensor_idx) {
auto tensor = graph_proto_->mutable_initializer(tensor_idx);
if (utils::HasExternalDataInMemory(*tensor)) {
std::unique_ptr<ONNX_NAMESPACE::TensorProto> full_init;
ORT_THROW_IF_ERROR(utils::GetTensorProtoWithDataIfInMemory(*tensor, full_init));
tensor->clear_data_location();
tensor->clear_external_data();
tensor->set_raw_data(full_init->raw_data());
}
}
return *graph_proto_;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,10 @@ SubGraphCollection_t NvExecutionProvider::GetSupportedList(SubGraphCollection_t
SetAllGraphInputs(graph_build);
}

ORT_ENFORCE(graph_build.Resolve().IsOK());
auto status = graph_build.Resolve();
if (!status.IsOK()) {
ORT_THROW_IF_ERROR(ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "Graph resolve failed with error: " + status.ErrorMessage()));
}

// Add parent graph output to the subgraph
int i = 0;
Expand Down