ONNX Runtime
Loading...
Searching...
No Matches
Ort::detail::SessionImpl< T > Struct Template Reference

#include <onnxruntime_cxx_api.h>

Inheritance diagram for Ort::detail::SessionImpl< T >:
Ort::detail::ConstSessionImpl< T > Ort::detail::Base< T >

Public Types

using B = ConstSessionImpl< T >
 
using B = Base< T >
 
- Public Types inherited from Ort::detail::ConstSessionImpl< T >
using B = Base< T >
 
- Public Types inherited from Ort::detail::Base< T >
using contained_type = T
 

Public Member Functions

std::vector< ValueRun (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.
 
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)
 
void Run (const RunOptions &run_options, const IoBinding &)
 Wraps OrtApi::RunWithBinding.
 
void RunAsync (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, RunAsyncCallbackFn callback, void *user_data)
 Run the model asynchronously in a thread owned by intra op thread pool.
 
AllocatedStringPtr EndProfilingAllocated (OrtAllocator *allocator)
 End profiling and return a copy of the profiling file name.
 
- Public Member Functions inherited from Ort::detail::ConstSessionImpl< T >
size_t GetInputCount () const
 Returns the number of model inputs.
 
size_t GetOutputCount () const
 Returns the number of model outputs.
 
size_t GetOverridableInitializerCount () const
 Returns the number of inputs that have defaults that can be overridden.
 
AllocatedStringPtr GetInputNameAllocated (size_t index, OrtAllocator *allocator) const
 Returns a copy of input name at the specified index.
 
AllocatedStringPtr GetOutputNameAllocated (size_t index, OrtAllocator *allocator) const
 Returns a copy of output name at then specified index.
 
AllocatedStringPtr GetOverridableInitializerNameAllocated (size_t index, OrtAllocator *allocator) const
 Returns a copy of the overridable initializer name at then specified index.
 
uint64_t GetProfilingStartTimeNs () const
 Wraps OrtApi::SessionGetProfilingStartTimeNs.
 
ModelMetadata GetModelMetadata () const
 Wraps OrtApi::SessionGetModelMetadata.
 
TypeInfo GetInputTypeInfo (size_t index) const
 Wraps OrtApi::SessionGetInputTypeInfo.
 
TypeInfo GetOutputTypeInfo (size_t index) const
 Wraps OrtApi::SessionGetOutputTypeInfo.
 
TypeInfo GetOverridableInitializerTypeInfo (size_t index) const
 Wraps OrtApi::SessionGetOverridableInitializerTypeInfo.
 
- Public Member Functions inherited from Ort::detail::Base< T >
constexpr Base ()=default
 
constexpr Base (contained_type *p) noexcept
 
 ~Base ()
 
 Base (const Base &)=delete
 
Baseoperator= (const Base &)=delete
 
 Base (Base &&v) noexcept
 
Baseoperator= (Base &&v) noexcept
 
constexpr operator contained_type * () const noexcept
 
contained_typerelease ()
 Relinquishes ownership of the contained C object pointer The underlying object is not destroyed.
 

Additional Inherited Members

- Protected Attributes inherited from Ort::detail::Base< T >
contained_typep_ {}
 

Member Typedef Documentation

◆ B [1/2]

template<typename T >
using Ort::detail::SessionImpl< T >::B = ConstSessionImpl<T>

◆ B [2/2]

template<typename T >
using Ort::detail::ConstSessionImpl< T >::B = Base<T>

Member Function Documentation

◆ EndProfilingAllocated()

template<typename T >
AllocatedStringPtr Ort::detail::SessionImpl< T >::EndProfilingAllocated ( OrtAllocator allocator)

End profiling and return a copy of the profiling file name.

Parameters
allocatorto allocate memory for the copy of the string returned
Returns
a instance of smart pointer that would deallocate the buffer when out of scope. The OrtAllocator instances must be valid at the point of memory release. Wraps OrtApi::SessionEndProfiling

◆ Run() [1/3]

template<typename T >
std::vector< Value > Ort::detail::SessionImpl< T >::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)

Parameters
[in]run_options
[in]input_namesArray of null terminated strings of length input_count that is the list of input names
[in]input_valuesArray of Value objects of length input_count that is the list of input values
[in]input_countNumber of inputs (the size of the input_names & input_values arrays)
[in]output_namesArray of C style strings of length output_count that is the list of output names
[in]output_countNumber of outputs (the size of the output_names array)
Returns
A std::vector of Value objects that directly maps to the output_names array (eg. output_name[0] is the first entry of the returned vector)

◆ Run() [2/3]

template<typename T >
void Ort::detail::SessionImpl< T >::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)

◆ Run() [3/3]

template<typename T >
void Ort::detail::SessionImpl< T >::Run ( const RunOptions run_options,
const IoBinding  
)

◆ RunAsync()

template<typename T >
void Ort::detail::SessionImpl< T >::RunAsync ( 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,
RunAsyncCallbackFn  callback,
void *  user_data 
)

Run the model asynchronously in a thread owned by intra op thread pool.

Wraps OrtApi::RunAsync

Parameters
[in]run_options
[in]input_namesArray of null terminated UTF8 encoded strings of the input names
[in]input_valuesArray of Value objects of length input_count
[in]input_countNumber of elements in the input_names and inputs arrays
[in]output_namesArray of null terminated UTF8 encoded strings of the output names
[out]output_valuesArray of provided Values to be filled with outputs. On calling RunAsync, output_values[i] could either be initialized by a null pointer or a preallocated OrtValue*. Later, on invoking the callback, each output_values[i] of null will be filled with an OrtValue* allocated by onnxruntime. Then, an OrtValue** pointer will be casted from output_values, and pass to the callback. NOTE: it is customer's duty to finally release output_values and each of its member, regardless of whether the member (Ort::Value) is allocated by onnxruntime or preallocated by the customer.
[in]output_countNumber of elements in the output_names and outputs array
[in]callbackCallback function on model run completion
[in]user_dataUser data that pass back to the callback