Fix the bug of C++ sample in CANN EP file (#23186)

### Description
Fix the bug of C++ sample in CANN EP file
This commit is contained in:
Xinpeng Dou 2024-12-29 14:13:47 +08:00 committed by GitHub
parent af2f2d517c
commit c67816d65b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -256,6 +256,7 @@ void output_postprocess(std::vector<Ort::Value>& output_tensors) {
*/
void inference() {
const auto& api = Ort::GetApi();
Ort::Env env(ORT_LOGGING_LEVEL_WARNING);
// Enable cann graph in cann provider option.
OrtCANNProviderOptions* cann_options = nullptr;
@ -276,7 +277,7 @@ void inference() {
api.SessionOptionsAppendExecutionProvider_CANN(
static_cast<OrtSessionOptions*>(session_options), cann_options);
Ort::Session session(Ort::Env(), model_path, session_options);
Ort::Session session(env, model_path, session_options);
Ort::AllocatorWithDefaultOptions allocator;