-
Notifications
You must be signed in to change notification settings - Fork 3k
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
error about<include>"onnxruntime_cxx_api.h" #17939
Comments
你好 请问是怎么解决的? |
是编译器的问题,需要用C++14编译 :-std=c++14 |
好的解决了 非常感谢! |
In file included from src/main.cpp:3:0: 您好,这个问题怎么解决 |
You may try to update your g++ |
Thank you, it works. |
Describe the issue
I got an error when try to include "onnxruntime_cxx_api.h":
In file included from include/onnxruntime_cxx_api.h:27:0,
from src/main.cpp:3:
include/onnxruntime_float16.h: In static member function ‘static constexpr uint16_t onnxruntime_float16::Float16Impl::ToUint16Impl(float)’:
include/onnxruntime_float16.h:252:50: warning: narrowing conversion of ‘(255 << 23)’ from ‘int’ to ‘unsigned int’ inside { } [-Wnarrowing]
constexpr detail::float32_bits f32infty = {255 << 23};
^
include/onnxruntime_float16.h:254:79: warning: narrowing conversion of ‘((((127 - 15) + (23 - 10)) + 1) << 23)’ from ‘int’ to ‘unsigned int’ inside { } [-Wnarrowing]
constexpr detail::float32_bits denorm_magic = {((127 - 15) + (23 - 10) + 1) << 23};
^
include/onnxruntime_float16.h: In member function ‘float onnxruntime_float16::Float16Impl::ToFloatImpl() const’:
include/onnxruntime_float16.h:297:47: warning: narrowing conversion of ‘(113 << 23)’ from ‘int’ to ‘unsigned int’ inside { } [-Wnarrowing]
constexpr detail::float32_bits magic = {113 << 23};
^
In file included from src/main.cpp:3:0:
include/onnxruntime_cxx_api.h: In constructor ‘constexpr Ort::Float16_t::Float16_t(uint16_t)’:
include/onnxruntime_cxx_api.h:171:64: error: constexpr constructor does not have empty body
constexpr explicit Float16_t(uint16_t v) noexcept { val = v; }
^
include/onnxruntime_cxx_api.h: In static member function ‘static constexpr Ort::Float16_t Ort::Float16_t::FromBits(uint16_t)’:
include/onnxruntime_cxx_api.h:186:83: error: call to non-constexpr function ‘Ort::Float16_t::Float16_t(uint16_t)’
constexpr static Float16_t FromBits(uint16_t v) noexcept { return Float16_t(v); }
^
In file included from include/onnxruntime_cxx_api.h:27:0,
from src/main.cpp:3:
include/onnxruntime_float16.h: In instantiation of ‘static constexpr uint16_t onnxruntime_float16::Float16Impl::ToUint16Impl(float) [with Derived = Ort::Float16_t; uint16_t = short unsigned int]’:
include/onnxruntime_cxx_api.h:192:54: required from here
include/onnxruntime_float16.h:293:1: error: body of constexpr function ‘static constexpr uint16_t onnxruntime_float16::Float16Impl::ToUint16Impl(float) [with Derived = Ort::Float16_t; uint16_t = short unsigned int]’ not a return-statement
}
^
In file included from src/main.cpp:3:0:
include/onnxruntime_cxx_api.h: In constructor ‘constexpr Ort::BFloat16_t::BFloat16_t(uint16_t)’:
include/onnxruntime_cxx_api.h:315:65: error: constexpr constructor does not have empty body
constexpr explicit BFloat16_t(uint16_t v) noexcept { val = v; }
^
include/onnxruntime_cxx_api.h: In static member function ‘static constexpr Ort::BFloat16_t Ort::BFloat16_t::FromBits(uint16_t)’:
include/onnxruntime_cxx_api.h:327:85: error: call to non-constexpr function ‘Ort::BFloat16_t::BFloat16_t(uint16_t)’
static constexpr BFloat16_t FromBits(uint16_t v) noexcept { return BFloat16_t(v); }
^
include/onnxruntime_cxx_api.h: At global scope:
include/onnxruntime_cxx_api.h:1168:93: warning: ‘deprecated’ attribute directive ignored [-Wattributes]
[[deprecated("use GetShape()")]] void GetDimensions(int64_t* values, size_t values_count) const; ///< Wraps OrtApi::GetDimensions
^
src/main.cpp: In function ‘int main()’:
src/main.cpp:38:58: warning: ignoring return value of function declared with attribute warn_unused_result [-Wunused-result]
g_ort->CreateEnv(ORT_LOGGING_LEVEL_WARNING, "test", &env);
^
src/main.cpp:42:46: warning: ignoring return value of function declared with attribute warn_unused_result [-Wunused-result]
g_ort->CreateSessionOptions(&session_options);
^
src/main.cpp:45:66: warning: ignoring return value of ‘OrtStatus* OrtSessionOptionsAppendExecutionProvider_CUDA(OrtSessionOptions*, int)’, declared with attribute warn_unused_result [-Wunused-result]
OrtSessionOptionsAppendExecutionProvider_CUDA(session_options, 0); //use CUDA,注释则为CPU
^
src/main.cpp:56:73: warning: ignoring return value of function declared with attribute warn_unused_result [-Wunused-result]
g_ort->CreateSession(env, model_path.c_str(), session_options, &session);
^
src/main.cpp:82:135: warning: ignoring return value of function declared with attribute warn_unused_result [-Wunused-result]
g_ort->Run(session, NULL, inputNames, (const OrtValue* const*)&input_tensor, inputNodeNum, outputNames, outputNodeNum, &output_tensor);
To reproduce
Centos7
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
onnxruntime-linux-x64-gpu-1.16.1
Urgency
No response
Platform
Linux
OS Version
centos7
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
onnxruntime-linux-x64-gpu-1.16.1
ONNX Runtime API
C++
Architecture
X64
Execution Provider
CUDA
Execution Provider Library Version
No response
The text was updated successfully, but these errors were encountered: