Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About c++11 Using smart Pointers causes source code error protection problems #170

Open
xyz666888 opened this issue Aug 4, 2024 · 1 comment

Comments

@xyz666888
Copy link

In this file onnxruntime_cxx_api.h

If I use version 1.12.x and below

char* LookupCustomMetadataMap(const char* key , OrtAllocator* allocator )const;

///< Wraps OrtApi :: ModelMetadataLookupCustomMetadataMap

This may allow the current source code to compile correctly
However, when the Onnxruntime version is greater than 1.13.0, the version number is different. For details, see the official website
In most cases, version number 6 will be used,1.12.x or later cannot be loaded effectively, and Android will run in a flash.
For instance, terminating with uncaught exception of type Ort::Exception: inference_session.cc:1086 LoadOrtModel The ORT format model version [6] is not supported this build 1.12.1

no member error occurs when I try to upgrade
Because the functions I mentioned above have been deprecated in the new version

// namespace wekws
/home/xiao/apk_example/android/app/src/main/cpp/kws/keyword_spotting.cc:38:35: error: no member named 'LookupCustomMetadataMap' in 'Ort::ModelMetadata'

AllocatedStringPtr LookupCustomMetadataMapAllocated(const char* key , OrtAllocator* allocator) const; ///< Wraps
OrtApi :: ModelMetadataLookupCustomMetadataMap

This made me very upset and tried to change the source code to
cache_dim_ = std::stoi(metadata.LookupCustomMetadataMapAllocated("cache_dim", allocator).get());

To my regret, an error that I suspect is out of memory was reported

terminating with uncaught exception of type Ort::Exception: Got invalid dimensions for input: input for the following indices
index: 2 Got: 80 Expected: 40

Sent from PPHub

@xyz666888
Copy link
Author

xyz666888 commented Aug 4, 2024

)
8C61A5779C1DE464B01B0E5BF30AD627
8CF419C4459B3EB10984878AE0E52439

The first image is Onnxruntime 1.13.x and above, and the second image is version 1.12.x and below

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

No branches or pull requests

1 participant