HDK
|
#include <onnxruntime_cxx_api.h>
Public Types | |
using | B = ConstValueImpl< T > |
using | B = Base< T > |
Public Types inherited from Ort::detail::ConstValueImpl< T > | |
using | B = Base< T > |
Public Types inherited from Ort::detail::Base< T > | |
using | contained_type = T |
Public Member Functions | |
template<typename R > | |
R * | GetTensorMutableData () |
Returns a non-const typed pointer to an OrtValue/Tensor contained buffer No type checking is performed, the caller must ensure the type matches the tensor type. More... | |
void * | GetTensorMutableRawData () |
Returns a non-typed non-const pointer to a tensor contained data. More... | |
template<typename R > | |
R & | At (const std::vector< int64_t > &location) |
void | FillStringTensor (const char *const *s, size_t s_len) |
Set all strings at once in a string tensor More... | |
void | FillStringTensorElement (const char *s, size_t index) |
Set a single string in a string tensor More... | |
char * | GetResizedStringTensorElementBuffer (size_t index, size_t buffer_length) |
Allocate if necessary and obtain a pointer to a UTF-8 encoded string element buffer indexed by the flat element index, of the specified length. More... | |
void | UseCooIndices (int64_t *indices_data, size_t indices_num) |
Supplies COO format specific indices and marks the contained sparse tensor as being a COO format tensor. Values are supplied with a CreateSparseTensor() API. The supplied indices are not copied and the user allocated buffers lifespan must eclipse that of the OrtValue. The location of the indices is assumed to be the same as specified by OrtMemoryInfo argument at the creation time. More... | |
void | UseCsrIndices (int64_t *inner_data, size_t inner_num, int64_t *outer_data, size_t outer_num) |
Supplies CSR format specific indices and marks the contained sparse tensor as being a CSR format tensor. Values are supplied with a CreateSparseTensor() API. The supplied indices are not copied and the user allocated buffers lifespan must eclipse that of the OrtValue. The location of the indices is assumed to be the same as specified by OrtMemoryInfo argument at the creation time. More... | |
void | UseBlockSparseIndices (const Shape &indices_shape, int32_t *indices_data) |
Supplies BlockSparse format specific indices and marks the contained sparse tensor as being a BlockSparse format tensor. Values are supplied with a CreateSparseTensor() API. The supplied indices are not copied and the user allocated buffers lifespan must eclipse that of the OrtValue. The location of the indices is assumed to be the same as specified by OrtMemoryInfo argument at the creation time. More... | |
void | FillSparseTensorCoo (const OrtMemoryInfo *data_mem_info, const OrtSparseValuesParam &values_param, const int64_t *indices_data, size_t indices_num) |
The API will allocate memory using the allocator instance supplied to the CreateSparseTensor() API and copy the values and COO indices into it. If data_mem_info specifies that the data is located at difference device than the allocator, a X-device copy will be performed if possible. More... | |
void | FillSparseTensorCsr (const OrtMemoryInfo *data_mem_info, const OrtSparseValuesParam &values, const int64_t *inner_indices_data, size_t inner_indices_num, const int64_t *outer_indices_data, size_t outer_indices_num) |
The API will allocate memory using the allocator instance supplied to the CreateSparseTensor() API and copy the values and CSR indices into it. If data_mem_info specifies that the data is located at difference device than the allocator, a X-device copy will be performed if possible. More... | |
void | FillSparseTensorBlockSparse (const OrtMemoryInfo *data_mem_info, const OrtSparseValuesParam &values, const Shape &indices_shape, const int32_t *indices_data) |
The API will allocate memory using the allocator instance supplied to the CreateSparseTensor() API and copy the values and BlockSparse indices into it. If data_mem_info specifies that the data is located at difference device than the allocator, a X-device copy will be performed if possible. More... | |
Public Member Functions inherited from Ort::detail::ConstValueImpl< T > | |
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 void * | GetTensorRawData () 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 | |
Base & | operator= (const Base &)=delete |
Base (Base &&v) noexcept | |
Base & | operator= (Base &&v) noexcept |
constexpr | operator contained_type * () const noexcept |
contained_type * | release () |
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_type * | p_ {} |
Definition at line 1466 of file onnxruntime_cxx_api.h.
using Ort::detail::ValueImpl< T >::B = ConstValueImpl<T> |
Definition at line 1467 of file onnxruntime_cxx_api.h.
using Ort::detail::ConstValueImpl< T >::B = Base<T> |
Definition at line 1306 of file onnxruntime_cxx_api.h.
R & Ort::detail::ValueImpl< T >::At | ( | const std::vector< int64_t > & | location | ) |
by the vector of dims.
R |
location | [in] expressed by a vecotr of dimensions offsets |
Definition at line 1433 of file onnxruntime_cxx_inline.h.
void Ort::detail::ValueImpl< T >::FillSparseTensorBlockSparse | ( | const OrtMemoryInfo * | data_mem_info, |
const OrtSparseValuesParam & | values, | ||
const Shape & | indices_shape, | ||
const int32_t * | indices_data | ||
) |
The API will allocate memory using the allocator instance supplied to the CreateSparseTensor() API and copy the values and BlockSparse indices into it. If data_mem_info specifies that the data is located at difference device than the allocator, a X-device copy will be performed if possible.
data_mem_info | specified buffer memory description |
values | values buffer information |
indices_shape | indices shape. use {0} for fully sparse tensors |
indices_data | pointer to indices data or nullptr for fully sparse tensors |
Definition at line 1475 of file onnxruntime_cxx_inline.h.
void Ort::detail::ValueImpl< T >::FillSparseTensorCoo | ( | const OrtMemoryInfo * | data_mem_info, |
const OrtSparseValuesParam & | values_param, | ||
const int64_t * | indices_data, | ||
size_t | indices_num | ||
) |
The API will allocate memory using the allocator instance supplied to the CreateSparseTensor() API and copy the values and COO indices into it. If data_mem_info specifies that the data is located at difference device than the allocator, a X-device copy will be performed if possible.
data_mem_info | specified buffer memory description |
values_param | values buffer information. |
indices_data | coo indices buffer or nullptr for fully sparse data |
indices_num | number of COO indices or 0 for fully sparse data |
Definition at line 1457 of file onnxruntime_cxx_inline.h.
void Ort::detail::ValueImpl< T >::FillSparseTensorCsr | ( | const OrtMemoryInfo * | data_mem_info, |
const OrtSparseValuesParam & | values, | ||
const int64_t * | inner_indices_data, | ||
size_t | inner_indices_num, | ||
const int64_t * | outer_indices_data, | ||
size_t | outer_indices_num | ||
) |
The API will allocate memory using the allocator instance supplied to the CreateSparseTensor() API and copy the values and CSR indices into it. If data_mem_info specifies that the data is located at difference device than the allocator, a X-device copy will be performed if possible.
data_mem_info | specified buffer memory description |
values | values buffer information |
inner_indices_data | csr inner indices pointer or nullptr for fully sparse tensors |
inner_indices_num | number of csr inner indices or 0 for fully sparse tensors |
outer_indices_data | pointer to csr indices data or nullptr for fully sparse tensors |
outer_indices_num | number of csr outer indices or 0 |
Definition at line 1465 of file onnxruntime_cxx_inline.h.
void Ort::detail::ValueImpl< T >::FillStringTensor | ( | const char *const * | s, |
size_t | s_len | ||
) |
Set all strings at once in a string tensor
s | [in] An array of strings. Each string in this array must be null terminated. |
s_len | [in] Count of strings in s (Must match the size of value's tensor shape) |
Definition at line 1400 of file onnxruntime_cxx_inline.h.
void Ort::detail::ValueImpl< T >::FillStringTensorElement | ( | const char * | s, |
size_t | index | ||
) |
Set a single string in a string tensor
s | [in] A null terminated UTF-8 encoded string |
index | [in] Index of the string in the tensor to set |
Definition at line 1405 of file onnxruntime_cxx_inline.h.
|
inline |
Allocate if necessary and obtain a pointer to a UTF-8 encoded string element buffer indexed by the flat element index, of the specified length.
This API is for advanced usage. It avoids a need to construct an auxiliary array of string pointers, and allows to write data directly (do not zero terminate).
index | |
buffer_length |
Definition at line 1410 of file onnxruntime_cxx_inline.h.
R * Ort::detail::ValueImpl< T >::GetTensorMutableData | ( | ) |
Returns a non-const typed pointer to an OrtValue/Tensor contained buffer No type checking is performed, the caller must ensure the type matches the tensor type.
Definition at line 1425 of file onnxruntime_cxx_inline.h.
void * Ort::detail::ValueImpl< T >::GetTensorMutableRawData | ( | ) |
Returns a non-typed non-const pointer to a tensor contained data.
Definition at line 1417 of file onnxruntime_cxx_inline.h.
void Ort::detail::ValueImpl< T >::UseBlockSparseIndices | ( | const Shape & | indices_shape, |
int32_t * | indices_data | ||
) |
Supplies BlockSparse format specific indices and marks the contained sparse tensor as being a BlockSparse format tensor. Values are supplied with a CreateSparseTensor() API. The supplied indices are not copied and the user allocated buffers lifespan must eclipse that of the OrtValue. The location of the indices is assumed to be the same as specified by OrtMemoryInfo argument at the creation time.
indices_shape | indices shape or a {0} for fully sparse |
indices_data | user allocated buffer with indices or nullptr for fully spare tensors |
Definition at line 1452 of file onnxruntime_cxx_inline.h.
void Ort::detail::ValueImpl< T >::UseCooIndices | ( | int64_t * | indices_data, |
size_t | indices_num | ||
) |
Supplies COO format specific indices and marks the contained sparse tensor as being a COO format tensor. Values are supplied with a CreateSparseTensor() API. The supplied indices are not copied and the user allocated buffers lifespan must eclipse that of the OrtValue. The location of the indices is assumed to be the same as specified by OrtMemoryInfo argument at the creation time.
indices_data | pointer to the user allocated buffer with indices. Use nullptr for fully sparse tensors. |
indices_num | number of indices entries. Use 0 for fully sparse tensors |
Definition at line 1442 of file onnxruntime_cxx_inline.h.
void Ort::detail::ValueImpl< T >::UseCsrIndices | ( | int64_t * | inner_data, |
size_t | inner_num, | ||
int64_t * | outer_data, | ||
size_t | outer_num | ||
) |
Supplies CSR format specific indices and marks the contained sparse tensor as being a CSR format tensor. Values are supplied with a CreateSparseTensor() API. The supplied indices are not copied and the user allocated buffers lifespan must eclipse that of the OrtValue. The location of the indices is assumed to be the same as specified by OrtMemoryInfo argument at the creation time.
inner_data | pointer to the user allocated buffer with inner indices or nullptr for fully sparse tensors |
inner_num | number of csr inner indices or 0 for fully sparse tensors |
outer_data | pointer to the user allocated buffer with outer indices or nullptr for fully sparse tensors |
outer_num | number of csr outer indices or 0 for fully sparse tensors |
Definition at line 1447 of file onnxruntime_cxx_inline.h.