Skip to content

Add C# and Python language bindings for GetCompatibilityInfoFromModel / GetCompatibilityInfoFromModelBytes#27565

Merged
adrastogi merged 4 commits intomainfrom
adrastogi/add-language-bindings-for-metadata-api
Mar 14, 2026
Merged

Add C# and Python language bindings for GetCompatibilityInfoFromModel / GetCompatibilityInfoFromModelBytes#27565
adrastogi merged 4 commits intomainfrom
adrastogi/add-language-bindings-for-metadata-api

Conversation

@adrastogi
Copy link
Contributor

Description

This change adds C# and Python language bindings and tests for the recently-introduced GetCompatibilityInfoFromModel / GetCompatibilityInfoFromModelBytes API.

Motivation and Context

#27015 introduced a new API to facilitate getting the model compatibility information from the metadata of a model (either a file or the model bytes). For convenience, we should ideally have some other language bindings included to make consumption a little easier.

…ith 'import' and 'import from'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@adrastogi
Copy link
Contributor Author

@adrianlizarraga / @skottmckay, mind taking a look at this one whenever you can? Fills in some missing language bindings for that recently added API to get compat info from the model metadata. Thanks!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Python and C# bindings (plus tests) for the new C API helpers that extract EP compatibility info from a model’s metadata, enabling compatibility checks without creating an inference session.

Changes:

  • Added Python pybind exports for GetCompatibilityInfoFromModel / GetCompatibilityInfoFromModelBytes and expanded Python EP-compatibility tests.
  • Added C# OrtEnv APIs and native interop delegates for the two compatibility-info extraction functions.
  • Added C# unit tests for new APIs (mostly argument/error-path coverage) and test utilities to generate minimal ONNX models with metadata.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
onnxruntime/test/python/onnxruntime_test_python_ep_compatibility.py Adds model-bytes and file-path Python tests for compatibility-info extraction.
onnxruntime/python/onnxruntime_pybind_state.cc Exposes new C API helpers to Python via pybind and documents them.
csharp/test/Microsoft.ML.OnnxRuntime.Tests.Common/EpCompatibilityTests.cs Adds C# tests and an ONNX model builder helper for metadata-based compatibility info.
csharp/src/Microsoft.ML.OnnxRuntime/OrtEnv.shared.cs Adds public C# OrtEnv methods to extract compatibility info from model path/bytes.
csharp/src/Microsoft.ML.OnnxRuntime/NativeMethods.shared.cs Wires new C API function pointers and delegates into the C# interop layer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@adrastogi adrastogi merged commit d45686d into main Mar 14, 2026
94 of 95 checks passed
@adrastogi adrastogi deleted the adrastogi/add-language-bindings-for-metadata-api branch March 14, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants