OnnxRuntime
|
Wrapper around OrtSession. More...
#include <onnxruntime_cxx_api.h>
Inherits Ort::Base< OrtSession >.
Public Member Functions | |
Session (std::nullptr_t) | |
Create an empty Session object, must be assigned a valid one to be used. More... | |
Session (Env &env, const char *model_path, const SessionOptions &options) | |
Wraps OrtApi::CreateSession. More... | |
Session (Env &env, const char *model_path, const SessionOptions &options, OrtPrepackedWeightsContainer *prepacked_weights_container) | |
Wraps OrtApi::CreateSessionWithPrepackedWeightsContainer. More... | |
Session (Env &env, const void *model_data, size_t model_data_length, const SessionOptions &options) | |
Wraps OrtApi::CreateSessionFromArray. More... | |
Session (Env &env, const void *model_data, size_t model_data_length, const SessionOptions &options, OrtPrepackedWeightsContainer *prepacked_weights_container) | |
Wraps OrtApi::CreateSessionFromArrayWithPrepackedWeightsContainer. More... | |
std::vector< Value > | Run (const RunOptions &run_options, const char *const *input_names, const Value *input_values, size_t input_count, const char *const *output_names, size_t output_count) |
Run the model returning results in an Ort allocated vector. More... | |
void | Run (const RunOptions &run_options, const char *const *input_names, const Value *input_values, size_t input_count, const char *const *output_names, Value *output_values, size_t output_count) |
Run the model returning results in user provided outputs Same as Run(const RunOptions&, const char* const*, const Value*, size_t,const char* const*, size_t) More... | |
void | Run (const RunOptions &run_options, const struct IoBinding &) |
Wraps OrtApi::RunWithBinding. More... | |
size_t | GetInputCount () const |
Returns the number of model inputs. More... | |
size_t | GetOutputCount () const |
Returns the number of model outputs. More... | |
size_t | GetOverridableInitializerCount () const |
Returns the number of inputs that have defaults that can be overridden. More... | |
char * | GetInputName (size_t index, OrtAllocator *allocator) const |
Wraps OrtApi::SessionGetInputName. More... | |
AllocatedStringPtr | GetInputNameAllocated (size_t index, OrtAllocator *allocator) const |
Returns a copy of input name at the specified index. More... | |
char * | GetOutputName (size_t index, OrtAllocator *allocator) const |
Wraps OrtApi::SessionGetOutputName. More... | |
AllocatedStringPtr | GetOutputNameAllocated (size_t index, OrtAllocator *allocator) const |
Returns a copy of output name at then specified index. More... | |
char * | GetOverridableInitializerName (size_t index, OrtAllocator *allocator) const |
Wraps OrtApi::SessionGetOverridableInitializerName. More... | |
AllocatedStringPtr | GetOverridableInitializerNameAllocated (size_t index, OrtAllocator *allocator) const |
Returns a copy of the overridable initializer name at then specified index. More... | |
char * | EndProfiling (OrtAllocator *allocator) const |
Wraps OrtApi::SessionEndProfiling. More... | |
AllocatedStringPtr | EndProfilingAllocated (OrtAllocator *allocator) const |
Returns a copy of the profiling file name. More... | |
uint64_t | GetProfilingStartTimeNs () const |
Wraps OrtApi::SessionGetProfilingStartTimeNs. More... | |
ModelMetadata | GetModelMetadata () const |
Wraps OrtApi::SessionGetModelMetadata. More... | |
TypeInfo | GetInputTypeInfo (size_t index) const |
Wraps OrtApi::SessionGetInputTypeInfo. More... | |
TypeInfo | GetOutputTypeInfo (size_t index) const |
Wraps OrtApi::SessionGetOutputTypeInfo. More... | |
TypeInfo | GetOverridableInitializerTypeInfo (size_t index) const |
Wraps OrtApi::SessionGetOverridableInitializerTypeInfo. More... | |
Public Member Functions inherited from Ort::Base< OrtSession > | |
Base ()=default | |
Base (OrtSession *p) | |
~Base () | |
operator OrtSession * () | |
operator const OrtSession * () const | |
OrtSession * | release () |
Releases ownership of the contained pointer. More... | |
Additional Inherited Members | |
Public Types inherited from Ort::Base< OrtSession > | |
using | contained_type = OrtSession |
Protected Member Functions inherited from Ort::Base< OrtSession > | |
Base (const Base &)=delete | |
Base (Base &&v) noexcept | |
Base & | operator= (const Base &)=delete |
void | operator= (Base &&v) noexcept |
Protected Attributes inherited from Ort::Base< OrtSession > | |
OrtSession * | p_ |
Wrapper around OrtSession.
|
inlineexplicit |
Create an empty Session object, must be assigned a valid one to be used.
Ort::Session::Session | ( | Env & | env, |
const char * | model_path, | ||
const SessionOptions & | options | ||
) |
Wraps OrtApi::CreateSession.
Ort::Session::Session | ( | Env & | env, |
const char * | model_path, | ||
const SessionOptions & | options, | ||
OrtPrepackedWeightsContainer * | prepacked_weights_container | ||
) |
Ort::Session::Session | ( | Env & | env, |
const void * | model_data, | ||
size_t | model_data_length, | ||
const SessionOptions & | options | ||
) |
Ort::Session::Session | ( | Env & | env, |
const void * | model_data, | ||
size_t | model_data_length, | ||
const SessionOptions & | options, | ||
OrtPrepackedWeightsContainer * | prepacked_weights_container | ||
) |
char * Ort::Session::EndProfiling | ( | OrtAllocator * | allocator | ) | const |
Wraps OrtApi::SessionEndProfiling.
AllocatedStringPtr Ort::Session::EndProfilingAllocated | ( | OrtAllocator * | allocator | ) | const |
Returns a copy of the profiling file name.
allocator | to allocate memory for the copy of the string returned |
size_t Ort::Session::GetInputCount | ( | ) | const |
Returns the number of model inputs.
char * Ort::Session::GetInputName | ( | size_t | index, |
OrtAllocator * | allocator | ||
) | const |
Wraps OrtApi::SessionGetInputName.
AllocatedStringPtr Ort::Session::GetInputNameAllocated | ( | size_t | index, |
OrtAllocator * | allocator | ||
) | const |
Returns a copy of input name at the specified index.
index | must less than the value returned by GetInputCount() |
allocator | to allocate memory for the copy of the name returned |
TypeInfo Ort::Session::GetInputTypeInfo | ( | size_t | index | ) | const |
ModelMetadata Ort::Session::GetModelMetadata | ( | ) | const |
size_t Ort::Session::GetOutputCount | ( | ) | const |
Returns the number of model outputs.
char * Ort::Session::GetOutputName | ( | size_t | index, |
OrtAllocator * | allocator | ||
) | const |
Wraps OrtApi::SessionGetOutputName.
AllocatedStringPtr Ort::Session::GetOutputNameAllocated | ( | size_t | index, |
OrtAllocator * | allocator | ||
) | const |
Returns a copy of output name at then specified index.
index | must less than the value returned by GetOutputCount() |
allocator | to allocate memory for the copy of the name returned |
TypeInfo Ort::Session::GetOutputTypeInfo | ( | size_t | index | ) | const |
size_t Ort::Session::GetOverridableInitializerCount | ( | ) | const |
Returns the number of inputs that have defaults that can be overridden.
char * Ort::Session::GetOverridableInitializerName | ( | size_t | index, |
OrtAllocator * | allocator | ||
) | const |
Wraps OrtApi::SessionGetOverridableInitializerName.
AllocatedStringPtr Ort::Session::GetOverridableInitializerNameAllocated | ( | size_t | index, |
OrtAllocator * | allocator | ||
) | const |
Returns a copy of the overridable initializer name at then specified index.
index | must less than the value returned by GetOverridableInitializerCount() |
allocator | to allocate memory for the copy of the name returned |
TypeInfo Ort::Session::GetOverridableInitializerTypeInfo | ( | size_t | index | ) | const |
uint64_t Ort::Session::GetProfilingStartTimeNs | ( | ) | const |
std::vector< Value > Ort::Session::Run | ( | const RunOptions & | run_options, |
const char *const * | input_names, | ||
const Value * | input_values, | ||
size_t | input_count, | ||
const char *const * | output_names, | ||
size_t | output_count | ||
) |
Run the model returning results in an Ort allocated vector.
Wraps OrtApi::Run
The caller provides a list of inputs and a list of the desired outputs to return.
See the output logs for more information on warnings/errors that occur while processing the model. Common errors are.. (TODO)
[in] | run_options | |
[in] | input_names | Array of null terminated strings of length input_count that is the list of input names |
[in] | input_values | Array of Value objects of length input_count that is the list of input values |
[in] | input_count | Number of inputs (the size of the input_names & input_values arrays) |
[in] | output_names | Array of C style strings of length output_count that is the list of output names |
[in] | output_count | Number of outputs (the size of the output_names array) |
void Ort::Session::Run | ( | const RunOptions & | run_options, |
const char *const * | input_names, | ||
const Value * | input_values, | ||
size_t | input_count, | ||
const char *const * | output_names, | ||
Value * | output_values, | ||
size_t | output_count | ||
) |
Run the model returning results in user provided outputs Same as Run(const RunOptions&, const char* const*, const Value*, size_t,const char* const*, size_t)
void Ort::Session::Run | ( | const RunOptions & | run_options, |
const struct IoBinding & | |||
) |
Wraps OrtApi::RunWithBinding.