Skip to content

Migrate batch-model-explorer to modern onnxruntime C++ API - #585

Open
Reginald Alfret V (reginaldalfret) wants to merge 1 commit into
microsoft:mainfrom
reginaldalfret:fix/batch-model-explorer-cxx-api
Open

Reginald Alfret V (reginaldalfret) wants to merge 1 commit into
microsoft:mainfrom
reginaldalfret:fix/batch-model-explorer-cxx-api

Conversation

@reginaldalfret

Copy link
Copy Markdown

Description

This PR resolves #451 by migrating c_cxx/model-explorer/batch-model-explorer.cpp from the deprecated experimental C++ API (experimental_onnxruntime_cxx_api.h) to the standard onnxruntime_cxx_api.h API.

Specifically:

  • Replaced <experimental_onnxruntime_cxx_api.h> with <onnxruntime_cxx_api.h>.
  • Replaced Ort::Experimental::Session with standard Ort::Session.
  • Replaced removed experimental methods session.GetInputNames() / session.GetInputShapes() / session.GetOutputNames() / session.GetOutputShapes() with standard allocated getters session.GetInputNameAllocated(), session.GetInputTypeInfo(), session.GetOutputNameAllocated(), and session.GetOutputTypeInfo().
  • Replaced Ort::Experimental::Value::CreateTensor with Ort::Value::CreateTensor.
  • Re-enabled batch-model-explorer target in c_cxx/model-explorer/CMakeLists.txt (previously commented out with #TODO: fix the build error).
  • Updated outdated header comments in model-explorer.cpp and batch-model-explorer.cpp referencing "experimental C++ API".

Motivation and Context

batch-model-explorer.cpp failed to compile against modern ONNX Runtime due to relying on the removed experimental API, preventing the target from being built.

Fixes #451

Testing

  • Reproduced build failure with the deprecated experimental header and methods.
  • Built both model-explorer and batch-model-explorer via CMake with ONNX Runtime v1.20.1 headers/libraries; verified clean compilation and linking with 0 warnings/errors.
  • Verified clean git diff --check.

Migrate batch-model-explorer.cpp from the deprecated experimental C++
API (experimental_onnxruntime_cxx_api.h) to the standard onnxruntime C++
API (onnxruntime_cxx_api.h).

Specifically:
- Replace experimental headers and Ort::Experimental::Session with standard Ort::Session.
- Replace removed session.GetInputNames()/session.GetInputShapes() with session.GetInputNameAllocated() and session.GetInputTypeInfo().
- Replace removed session.GetOutputNames()/session.GetOutputShapes() with session.GetOutputNameAllocated() and session.GetOutputTypeInfo().
- Replace Ort::Experimental::Value::CreateTensor with Ort::Value::CreateTensor.
- Re-enable batch-model-explorer target in model-explorer/CMakeLists.txt.
- Update header comments in model-explorer.cpp to remove obsolete experimental API references.

Fixes microsoft#451

Signed-off-by: Reginald Alfret <reginaldalfret@gmail.com>
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.

error: ‘struct Ort::Session’ has no member named ‘GetInputNames’

1 participant