|
| OM_EXTERNAL_VISIBILITY OMTensor * | omTensorCreate (void *data_ptr, const int64_t *shape, int64_t rank, OM_DATA_TYPE dtype) |
| | Create a OMTensor with specified data pointer, shape, rank and element type.
|
| OM_EXTERNAL_VISIBILITY OMTensor * | omTensorCreateWithOwnership (void *data_ptr, const int64_t *shape, int64_t rank, OM_DATA_TYPE dtype, int64_t owning) |
| | Create an OMTensor with specified data pointer, shape, rank and element type, manually setting data ptr ownership.
|
| OM_EXTERNAL_VISIBILITY OMTensor * | omTensorCreateEmpty (const int64_t *shape, int64_t rank, OM_DATA_TYPE dtype) |
| OM_EXTERNAL_VISIBILITY void | omTensorDestroy (OMTensor *tensor) |
| | Destroy the OMTensor struct.
|
| OM_EXTERNAL_VISIBILITY void * | omTensorGetDataPtr (const OMTensor *tensor) |
| | OMTensor data pointer getter.
|
| OM_EXTERNAL_VISIBILITY void * | omTensorGetAllocatedPtr (const OMTensor *tensor) |
| | OMTensor allocated data pointer getter.
|
| OM_EXTERNAL_VISIBILITY const int64_t * | omTensorGetShape (const OMTensor *tensor) |
| | OMTensor data shape getter.
|
| OM_EXTERNAL_VISIBILITY OM_DATA_TYPE | omTensorGetDataType (const OMTensor *tensor) |
| | OMTensor data type getter.
|
| OM_EXTERNAL_VISIBILITY int64_t | omTensorGetBufferSize (const OMTensor *tensor) |
| | OMTensor numerical data buffer size getter.
|
| OM_EXTERNAL_VISIBILITY int64_t | omTensorGetRank (const OMTensor *tensor) |
| | OMTensor rank getter.
|
| OM_EXTERNAL_VISIBILITY int64_t | omTensorGetNumElems (const OMTensor *tensor) |
| | OMTensor number of elements getter.
|
| OM_EXTERNAL_VISIBILITY int64_t | omTensorGetOwning (const OMTensor *tensor) |
| | OMTensor owning flag getter.
|
| OM_EXTERNAL_VISIBILITY void | omTensorSetOwning (OMTensor *tensor, int64_t owning) |
| | OMTensor owning flag setter.
|
| OM_EXTERNAL_VISIBILITY void | omTensorPrint (const char *msg, const OMTensor *tensor) |
| OM_EXTERNAL_VISIBILITY OMTensor * omTensorCreate |
( |
void * | data_ptr, |
|
|
const int64_t * | shape, |
|
|
int64_t | rank, |
|
|
OM_DATA_TYPE | dtype ) |
Create a OMTensor with specified data pointer, shape, rank and element type.
The call will create a copy of the shape array but will not create a copy of the data numerical values. The shape array is copied without being freed, so users are expected to manage the shape array oneself. By default, users are responsible for managing the memory the numerical data pointer refers to, keeping the numerical data alive for the duration of the usage of the created tensor and freeing the numerical data after the last use of the created tensor. Namely, the OMTensor is not the owner of the numerical data. To indicate OMTensor's ownership of numerical data, use omTensorCreateWithOwnership. Ownership determines what happens with the OMTensor is destroyed. With ownership of the numerical data, the destruction of the OMTensor will also free the numerical data associated with the tensor.
OM_DATA_TYPE enumerates the ONNX data types: INT/UINT 8/16/32/64, BOOL, FLOAT16, BFLOAT16, FLOAT, DOUBLE, COMPLEX 64/128, and STRING. For example, a 32-bit signed-integer is represented by the ONNX_TYPE_INT32 enum value.
- Parameters
-
| data_ptr | pointer to tensor data numerical values. By default, caller is responsible for managing the memory this pointer refers to. |
| shape | list of integers indicating the tensor shape. |
| rank | tensor rank. |
| dtype | tensor element data type. |
- Returns
- pointer to OMTensor created, NULL if creation failed.
| OM_EXTERNAL_VISIBILITY OMTensor * omTensorCreateEmpty |
( |
const int64_t * | shape, |
|
|
int64_t | rank, |
|
|
OM_DATA_TYPE | dtype ) |
Create an OMTensor with the specified shape, rank and element type, allocate uninitialized data for the specified shape.
The OMTensor created using this constructor owns the underlying memory space allocated to hold the content of the tensor numerical values.
OM_DATA_TYPE enumerates the ONNX data types: INT/UINT 8/16/32/64, BOOL, FLOAT16, BFLOAT16, FLOAT, DOUBLE, COMPLEX 64/128, and STRING. For example, a 32-bit floating-point is represented by the ONNX_TYPE_FLOAT enum value.
- Parameters
-
| shape | list of integers indicating the tensor shape. |
| rank | tensor rank. |
| dtype | tensor element data type. |
- Returns
- pointer to OMTensor created, NULL if creation failed.
| OM_EXTERNAL_VISIBILITY OMTensor * omTensorCreateWithOwnership |
( |
void * | data_ptr, |
|
|
const int64_t * | shape, |
|
|
int64_t | rank, |
|
|
OM_DATA_TYPE | dtype, |
|
|
int64_t | owning ) |
Create an OMTensor with specified data pointer, shape, rank and element type, manually setting data ptr ownership.
The call will create a copy of the shape array but will not create a copy of the numerical data. The shape array is copied without being freed, so users are expected to manage the shape array oneself. Users can specify whether OMTensor owns the numerical data, which subsequently determines whether the memory space underlying the numerical data will be freed or not when OMTensor gets destroyed. Namely, if the ownership flag is set to false, users are responsible for keeping the numerical data live until the last use of the tensor and freeing the numerical data memory after its last use. If the ownership is set to true, then the destruction of the tensor will also free the numerical data associated with the tensor.
OM_DATA_TYPE enumerates the ONNX data types: INT/UINT 8/16/32/64, BOOL, FLOAT16, BFLOAT16, FLOAT, DOUBLE, COMPLEX 64/128, and STRING. For example, a 32-bit unsigned-integer is represented by the ONNX_TYPE_UINT32 enum value.
- Parameters
-
| data_ptr | pointer to tensor numerical data values. |
| shape | list of integers indicating the tensor shape. |
| rank | tensor rank. |
| dtype | tensor element data type. |
| owning | whether OMTensor owns the data, if set to true, OMTensor will release the data_ptr upon destruction. |
- Returns
- pointer to OMTensor created, NULL if creation failed.
| OM_EXTERNAL_VISIBILITY OM_DATA_TYPE omTensorGetDataType |
( |
const OMTensor * | tensor | ) |
|
OMTensor data type getter.
OM_DATA_TYPE enumerates the ONNX data types: INT/UINT 8/16/32/64, BOOL, FLOAT16, BFLOAT16, FLOAT, DOUBLE, COMPLEX 64/128, and STRING. For example, a string is represented by the ONNX_TYPE_STRING enum value.
- Parameters
-
- Returns
- ONNX data type of the data buffer elements.