Skip to content

Commit 93d5614

Browse files
committed
Address review comments
1 parent 397fd13 commit 93d5614

File tree

1 file changed

+15
-4
lines changed
  • include/onnxruntime/core/graph

1 file changed

+15
-4
lines changed

include/onnxruntime/core/graph/graph.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,11 +1570,22 @@ class Graph { // NOLINT(clang-analyzer-optin.performance.Padding): preserve exi
15701570
std::optional<std::string_view> new_name);
15711571

15721572
/// <summary>
1573-
/// Subgraph initializers are already copied using Node::ToProto()
1573+
/// This function is used by ToGraphProto() to ensure in-memory external data references
1574+
/// don't leak externally since they are non-standard.
1575+
///
1576+
/// It handles two scenarios:
1577+
/// - When GraphSynchronizationNeeded() is false: GraphProto is simply copied
1578+
/// from graph_proto_ by ToGraphProto(). This copy includes both main graph
1579+
/// and subgraph initializers. This function examines all initializers
1580+
/// and inlines any in-memory data references.
1581+
/// - When GraphSynchronizationNeeded() is true: ToGraphProto() generates a new GraphProto
1582+
/// using ToGraphProtoInternal(). This doesn't transfer main graph initializers, which are
1583+
/// copied and inlined by ToGraphProto() itself. This function processes only the subgraph initializers
1584+
/// as needed.
15741585
/// </summary>
1575-
/// <param name="output_graph_proto"></param>
1576-
/// <param name="process_main">process main graph if true</param>
1577-
/// <returns>Status</returns>
1586+
/// <param name="output_graph_proto">The GraphProto to process</param>
1587+
/// <param name="process_main">Whether to process the main graph initializers</param>
1588+
/// <returns>Status indicating success or failure</returns> ///
15781589
Status ProcessSubgraphsInMemoryData(ONNX_NAMESPACE::GraphProto& output_graph_proto, bool process_main) const;
15791590

15801591
/// <summary>

0 commit comments

Comments
 (0)