Migrate batch-model-explorer to modern onnxruntime C++ API - #585
Open
Reginald Alfret V (reginaldalfret) wants to merge 1 commit into
Open
Reginald Alfret V (reginaldalfret) wants to merge 1 commit into
Reginald Alfret V (reginaldalfret) wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR resolves #451 by migrating
c_cxx/model-explorer/batch-model-explorer.cppfrom the deprecated experimental C++ API (experimental_onnxruntime_cxx_api.h) to the standardonnxruntime_cxx_api.hAPI.Specifically:
<experimental_onnxruntime_cxx_api.h>with<onnxruntime_cxx_api.h>.Ort::Experimental::Sessionwith standardOrt::Session.session.GetInputNames()/session.GetInputShapes()/session.GetOutputNames()/session.GetOutputShapes()with standard allocated getterssession.GetInputNameAllocated(),session.GetInputTypeInfo(),session.GetOutputNameAllocated(), andsession.GetOutputTypeInfo().Ort::Experimental::Value::CreateTensorwithOrt::Value::CreateTensor.batch-model-explorertarget inc_cxx/model-explorer/CMakeLists.txt(previously commented out with#TODO: fix the build error).model-explorer.cppandbatch-model-explorer.cppreferencing "experimental C++ API".Motivation and Context
batch-model-explorer.cppfailed to compile against modern ONNX Runtime due to relying on the removed experimental API, preventing the target from being built.Fixes #451
Testing
model-explorerandbatch-model-explorervia CMake with ONNX Runtime v1.20.1 headers/libraries; verified clean compilation and linking with 0 warnings/errors.git diff --check.