HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Ort::detail::ConstValueImpl< T > Struct Template Reference

#include <onnxruntime_cxx_api.h>

+ Inheritance diagram for Ort::detail::ConstValueImpl< T >:

Public Types

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

Public Member Functions

template<typename R >
void GetOpaqueData (const char *domain, const char *type_name, R &) const
 Obtains a pointer to a user defined data for experimental purposes More...
 
bool IsTensor () const
 Returns true if Value is a tensor, false for other types like map/sequence/etc. More...
 
bool HasValue () const
 
size_t GetCount () const
 < Return true if OrtValue contains data and returns false if the OrtValue is a None More...
 
Value GetValue (int index, OrtAllocator *allocator) const
 
size_t GetStringTensorDataLength () const
 This API returns a full length of string data contained within either a tensor or a sparse Tensor. For sparse tensor it returns a full length of stored non-empty strings (values). The API is useful for allocating necessary memory and calling GetStringTensorContent(). More...
 
void GetStringTensorContent (void *buffer, size_t buffer_length, size_t *offsets, size_t offsets_count) const
 The API copies all of the UTF-8 encoded string data contained within a tensor or a sparse tensor into a supplied buffer. Use GetStringTensorDataLength() to find out the length of the buffer to allocate. The user must also allocate offsets buffer with the number of entries equal to that of the contained strings. More...
 
template<typename R >
const R * GetTensorData () const
 Returns a const typed pointer to the tensor contained data. No type checking is performed, the caller must ensure the type matches the tensor type. More...
 
const voidGetTensorRawData () const
 Returns a non-typed pointer to a tensor contained data. More...
 
TypeInfo GetTypeInfo () const
 The API returns type information for data contained in a tensor. For sparse tensors it returns type information for contained non-zero values. It returns dense shape for sparse tensors. More...
 
TensorTypeAndShapeInfo GetTensorTypeAndShapeInfo () const
 The API returns type information for data contained in a tensor. For sparse tensors it returns type information for contained non-zero values. It returns dense shape for sparse tensors. More...
 
ConstMemoryInfo GetTensorMemoryInfo () const
 This API returns information about the memory allocation used to hold data. More...
 
void GetStringTensorElement (size_t buffer_length, size_t element_index, void *buffer) const
 The API copies UTF-8 encoded bytes for the requested string element contained within a tensor or a sparse tensor into a provided buffer. Use GetStringTensorElementLength() to obtain the length of the buffer to allocate. More...
 
std::string GetStringTensorElement (size_t element_index) const
 Returns string tensor UTF-8 encoded string element. Use of this API is recommended over GetStringTensorElement() that takes void* buffer pointer. More...
 
size_t GetStringTensorElementLength (size_t element_index) const
 The API returns a byte length of UTF-8 encoded string element contained in either a tensor or a spare tensor values. More...
 
OrtSparseFormat GetSparseFormat () const
 The API returns the sparse data format this OrtValue holds in a sparse tensor. If the sparse tensor was not fully constructed, i.e. Use*() or Fill*() API were not used the value returned is ORT_SPARSE_UNDEFINED. More...
 
TensorTypeAndShapeInfo GetSparseTensorValuesTypeAndShapeInfo () const
 The API returns type and shape information for stored non-zero values of the sparse tensor. Use GetSparseTensorValues() to obtain values buffer pointer. More...
 
TensorTypeAndShapeInfo GetSparseTensorIndicesTypeShapeInfo (OrtSparseIndicesFormat format) const
 The API returns type and shape information for the specified indices. Each supported indices have their own enum values even if a give format has more than one kind of indices. Use GetSparseTensorIndicesData() to obtain pointer to indices buffer. More...
 
template<typename R >
const R * GetSparseTensorIndicesData (OrtSparseIndicesFormat indices_format, size_t &num_indices) const
 The API retrieves a pointer to the internal indices buffer. The API merely performs a convenience data type casting on the return type pointer. Make sure you are requesting the right type, use GetSparseTensorIndicesTypeShapeInfo(); More...
 
bool IsSparseTensor () const
 Returns true if the OrtValue contains a sparse tensor More...
 
template<typename R >
const R * GetSparseTensorValues () const
 The API returns a pointer to an internal buffer of the sparse tensor containing non-zero values. The API merely does casting. Make sure you are requesting the right data type by calling GetSparseTensorValuesTypeAndShapeInfo() first. More...
 
- 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. More...
 

Additional Inherited Members

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

Detailed Description

template<typename T>
struct Ort::detail::ConstValueImpl< T >

Definition at line 1305 of file onnxruntime_cxx_api.h.

Member Typedef Documentation

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

Definition at line 1306 of file onnxruntime_cxx_api.h.

Member Function Documentation

template<typename T >
size_t Ort::detail::ConstValueImpl< T >::GetCount ( ) const
inline

< Return true if OrtValue contains data and returns false if the OrtValue is a None

Definition at line 1268 of file onnxruntime_cxx_inline.h.

template<typename T >
template<typename R >
void Ort::detail::ConstValueImpl< T >::GetOpaqueData ( const char *  domain,
const char *  type_name,
R &  out 
) const
inline

Obtains a pointer to a user defined data for experimental purposes

Wraps OrtApi::GetOpaqueValue

Definition at line 1249 of file onnxruntime_cxx_inline.h.

template<typename T >
OrtSparseFormat Ort::detail::ConstValueImpl< T >::GetSparseFormat ( ) const
inline

The API returns the sparse data format this OrtValue holds in a sparse tensor. If the sparse tensor was not fully constructed, i.e. Use*() or Fill*() API were not used the value returned is ORT_SPARSE_UNDEFINED.

Returns
Format enum

Definition at line 1354 of file onnxruntime_cxx_inline.h.

template<typename T >
template<typename R >
const R * Ort::detail::ConstValueImpl< T >::GetSparseTensorIndicesData ( OrtSparseIndicesFormat  indices_format,
size_t &  num_indices 
) const
inline

The API retrieves a pointer to the internal indices buffer. The API merely performs a convenience data type casting on the return type pointer. Make sure you are requesting the right type, use GetSparseTensorIndicesTypeShapeInfo();

Template Parameters
Ttype to cast to
Parameters
indices_formatrequested indices kind
num_indicesnumber of indices entries
Returns
Pinter to the internal sparse tensor buffer containing indices. Do not free this pointer.

Definition at line 1376 of file onnxruntime_cxx_inline.h.

template<typename T >
TensorTypeAndShapeInfo Ort::detail::ConstValueImpl< T >::GetSparseTensorIndicesTypeShapeInfo ( OrtSparseIndicesFormat  format) const
inline

The API returns type and shape information for the specified indices. Each supported indices have their own enum values even if a give format has more than one kind of indices. Use GetSparseTensorIndicesData() to obtain pointer to indices buffer.

Parameters
formatenum requested
Returns
type and shape information

Definition at line 1368 of file onnxruntime_cxx_inline.h.

template<typename T >
template<typename R >
const R * Ort::detail::ConstValueImpl< T >::GetSparseTensorValues ( ) const
inline

The API returns a pointer to an internal buffer of the sparse tensor containing non-zero values. The API merely does casting. Make sure you are requesting the right data type by calling GetSparseTensorValuesTypeAndShapeInfo() first.

Template Parameters
Tnumeric data types only. Use GetStringTensor*() to retrieve strings.
Returns
a pointer to the internal values buffer. Do not free this pointer.

Definition at line 1391 of file onnxruntime_cxx_inline.h.

template<typename T >
TensorTypeAndShapeInfo Ort::detail::ConstValueImpl< T >::GetSparseTensorValuesTypeAndShapeInfo ( ) const
inline

The API returns type and shape information for stored non-zero values of the sparse tensor. Use GetSparseTensorValues() to obtain values buffer pointer.

Returns
TensorTypeAndShapeInfo values information

Definition at line 1361 of file onnxruntime_cxx_inline.h.

template<typename T >
void Ort::detail::ConstValueImpl< T >::GetStringTensorContent ( void buffer,
size_t  buffer_length,
size_t *  offsets,
size_t  offsets_count 
) const
inline

The API copies all of the UTF-8 encoded string data contained within a tensor or a sparse tensor into a supplied buffer. Use GetStringTensorDataLength() to find out the length of the buffer to allocate. The user must also allocate offsets buffer with the number of entries equal to that of the contained strings.

Strings are always assumed to be on CPU, no X-device copy.

Parameters
bufferuser allocated buffer
buffer_lengthlength in bytes of the allocated buffer
offsetsa pointer to the offsets user allocated buffer
offsets_countcount of offsets, must be equal to the number of strings contained. that can be obtained from the shape of the tensor or from GetSparseTensorValuesTypeAndShapeInfo() for sparse tensors

Definition at line 1348 of file onnxruntime_cxx_inline.h.

template<typename T >
size_t Ort::detail::ConstValueImpl< T >::GetStringTensorDataLength ( ) const
inline

This API returns a full length of string data contained within either a tensor or a sparse Tensor. For sparse tensor it returns a full length of stored non-empty strings (values). The API is useful for allocating necessary memory and calling GetStringTensorContent().

Returns
total length of UTF-8 encoded bytes contained. No zero terminators counted.

Definition at line 1282 of file onnxruntime_cxx_inline.h.

template<typename T >
void Ort::detail::ConstValueImpl< T >::GetStringTensorElement ( size_t  buffer_length,
size_t  element_index,
void buffer 
) const
inline

The API copies UTF-8 encoded bytes for the requested string element contained within a tensor or a sparse tensor into a provided buffer. Use GetStringTensorElementLength() to obtain the length of the buffer to allocate.

Parameters
buffer_length
element_index
buffer

Definition at line 1332 of file onnxruntime_cxx_inline.h.

template<typename T >
std::string Ort::detail::ConstValueImpl< T >::GetStringTensorElement ( size_t  element_index) const
inline

Returns string tensor UTF-8 encoded string element. Use of this API is recommended over GetStringTensorElement() that takes void* buffer pointer.

Parameters
element_index
Returns
std::string

Definition at line 1337 of file onnxruntime_cxx_inline.h.

template<typename T >
size_t Ort::detail::ConstValueImpl< T >::GetStringTensorElementLength ( size_t  element_index) const
inline

The API returns a byte length of UTF-8 encoded string element contained in either a tensor or a spare tensor values.

Parameters
element_index
Returns
byte length for the specified string element

Definition at line 1289 of file onnxruntime_cxx_inline.h.

template<typename T >
template<typename R >
const R * Ort::detail::ConstValueImpl< T >::GetTensorData ( ) const
inline

Returns a const typed pointer to the tensor contained data. No type checking is performed, the caller must ensure the type matches the tensor type.

Template Parameters
T
Returns
const pointer to data, no copies made

Wraps OrtApi::GetTensorMutableData ///

Definition at line 1297 of file onnxruntime_cxx_inline.h.

template<typename T >
ConstMemoryInfo Ort::detail::ConstValueImpl< T >::GetTensorMemoryInfo ( ) const
inline

This API returns information about the memory allocation used to hold data.

Returns
Non owning instance of MemoryInfo

Definition at line 1325 of file onnxruntime_cxx_inline.h.

template<typename T >
const void * Ort::detail::ConstValueImpl< T >::GetTensorRawData ( ) const
inline

Returns a non-typed pointer to a tensor contained data.

Returns
const pointer to data, no copies made

Definition at line 1304 of file onnxruntime_cxx_inline.h.

template<typename T >
TensorTypeAndShapeInfo Ort::detail::ConstValueImpl< T >::GetTensorTypeAndShapeInfo ( ) const
inline

The API returns type information for data contained in a tensor. For sparse tensors it returns type information for contained non-zero values. It returns dense shape for sparse tensors.

Returns
TensorTypeAndShapeInfo

Definition at line 1318 of file onnxruntime_cxx_inline.h.

template<typename T >
TypeInfo Ort::detail::ConstValueImpl< T >::GetTypeInfo ( ) const
inline

The API returns type information for data contained in a tensor. For sparse tensors it returns type information for contained non-zero values. It returns dense shape for sparse tensors.

Returns
TypeInfo

Definition at line 1311 of file onnxruntime_cxx_inline.h.

template<typename T >
Value Ort::detail::ConstValueImpl< T >::GetValue ( int  index,
OrtAllocator *  allocator 
) const
inline

Definition at line 1275 of file onnxruntime_cxx_inline.h.

template<typename T >
bool Ort::detail::ConstValueImpl< T >::HasValue ( ) const
inline

Definition at line 1261 of file onnxruntime_cxx_inline.h.

template<typename T >
bool Ort::detail::ConstValueImpl< T >::IsSparseTensor ( ) const
inline

Returns true if the OrtValue contains a sparse tensor

Returns

Definition at line 1383 of file onnxruntime_cxx_inline.h.

template<typename T >
bool Ort::detail::ConstValueImpl< T >::IsTensor ( ) const
inline

Returns true if Value is a tensor, false for other types like map/sequence/etc.

Definition at line 1254 of file onnxruntime_cxx_inline.h.


The documentation for this struct was generated from the following files: