-
Notifications
You must be signed in to change notification settings - Fork 700
/
ort_config.h
35 lines (28 loc) · 1.02 KB
/
ort_config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// Created by DefTruth on 2021/3/29.
//
#ifndef LITE_AI_ORT_CORE_ORT_CONFIG_H
#define LITE_AI_ORT_CORE_ORT_CONFIG_H
#include "ort_defs.h"
#include "lite/lite.ai.headers.h"
#ifdef ENABLE_ONNXRUNTIME
#include "onnxruntime_cxx_api.h"
#endif
inline static std::string OrtCompatiableGetInputName(size_t index, OrtAllocator* allocator,
Ort::Session *ort_session) {
#if ORT_API_VERSION >= 14
return std::string(ort_session->GetInputNameAllocated(index, allocator).get());
#else
return std::string(ort_session->GetInputName(index, allocator));
#endif
}
inline static std::string OrtCompatiableGetOutputName(size_t index, OrtAllocator* allocator,
Ort::Session *ort_session) {
#if ORT_API_VERSION >= 14
return std::string(ort_session->GetOutputNameAllocated(index, allocator).get());
#else
return std::string(ort_session->GetOutputName(index, allocator));
#endif
}
namespace core {}
#endif //LITE_AI_ORT_CORE_ORT_CONFIG_H