Skip to content
Merged
Prev Previous commit
Next Next commit
move Graph_GetModelMetadata to the end for compatibility
  • Loading branch information
wcy123 committed Aug 20, 2025
commit 92d6da08e68240ba72ecdefc56a954dcefa44db4
22 changes: 11 additions & 11 deletions include/onnxruntime/core/session/onnxruntime_c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -5644,17 +5644,6 @@ struct OrtApi {
*/
ORT_API2_STATUS(Graph_GetName, _In_ const OrtGraph* graph, _Outptr_ const char** graph_name);

/** \brief Get ::OrtModelMetadata from an ::OrtGraph
*
* \param[in] graph
* \param[out] out Newly created ::OrtModelMetadata. Must be freed using OrtApi::ReleaseModelMetadata
*
* \snippet{doc} snippets.dox OrtStatus Return Value
*
* \since Version 1.23.
*/
ORT_API2_STATUS(Graph_GetModelMetadata, _In_ const OrtGraph* graph, _Outptr_ OrtModelMetadata** out);

/** \brief Returns the ONNX IR version.
*
* \param[in] graph The OrtGraph instance.
Expand Down Expand Up @@ -6476,6 +6465,17 @@ struct OrtApi {
_In_reads_(num_tensors) OrtValue* const* dst_tensors,
_In_opt_ OrtSyncStream* stream,
_In_ size_t num_tensors);

/** \brief Get ::OrtModelMetadata from an ::OrtGraph
*
* \param[in] graph
* \param[out] out Newly created ::OrtModelMetadata. Must be freed using OrtApi::ReleaseModelMetadata
*
* \snippet{doc} snippets.dox OrtStatus Return Value
*
* \since Version 1.23.
*/
ORT_API2_STATUS(Graph_GetModelMetadata, _In_ const OrtGraph* graph, _Outptr_ OrtModelMetadata** out);
};

/*
Expand Down
3 changes: 2 additions & 1 deletion onnxruntime/core/session/onnxruntime_c_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4044,7 +4044,6 @@ static constexpr OrtApi ort_api_1_to_23 = {
&OrtApis::ValueInfo_IsConstantInitializer,
&OrtApis::ValueInfo_IsFromOuterScope,
&OrtApis::Graph_GetName,
&OrtApis::Graph_GetModelMetadata,
&OrtApis::Graph_GetModelPath,
&OrtApis::Graph_GetOnnxIRVersion,
&OrtApis::Graph_GetNumOperatorSets,
Expand Down Expand Up @@ -4106,6 +4105,8 @@ static constexpr OrtApi ort_api_1_to_23 = {
&OrtApis::ReleaseSyncStream,

&OrtApis::CopyTensors,

&OrtApis::Graph_GetModelMetadata,
};

// OrtApiBase can never change as there is no way to know what version of OrtApiBase is returned by OrtGetApiBase.
Expand Down
Loading