TIOVX User Guide
|
Interface to Tensor APIs (modeled after OpenVX 1.2 tensor support) More...
Go to the source code of this file.
Typedefs | |
typedef struct _vx_tensor * | vx_tensor |
The multidimensional data object (Tensor). More... | |
Enumerations | |
enum | vx_ext_type_e { VX_TYPE_TENSOR = 0x815 } |
The Object Type Enumeration for Imports. | |
enum | vx_ext_context_attribute_e { VX_CONTEXT_MAX_TENSOR_DIMS = VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_CONTEXT) + 0xE } |
A list of context attributes. | |
enum | vx_tensor_attribute_e { VX_TENSOR_NUMBER_OF_DIMS = VX_ATTRIBUTE_BASE( VX_ID_KHRONOS, VX_TYPE_TENSOR ) + 0x0, VX_TENSOR_DIMS = VX_ATTRIBUTE_BASE( VX_ID_KHRONOS, VX_TYPE_TENSOR ) + 0x1, VX_TENSOR_DATA_TYPE = VX_ATTRIBUTE_BASE( VX_ID_KHRONOS, VX_TYPE_TENSOR ) + 0x2, VX_TENSOR_FIXED_POINT_POSITION = VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_TENSOR) + 0x3, TIVX_TENSOR_SCALING_DIVISOR = VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_TENSOR) + 0x4, TIVX_TENSOR_SCALING_DIVISOR_FIXED_POINT_POSITION = VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_TENSOR) + 0x5 } |
tensor Data attributes. More... | |
Functions | |
VX_API_ENTRY vx_tensor VX_API_CALL | vxCreateTensor (vx_context context, vx_size number_of_dims, const vx_size *dims, vx_enum data_type, vx_int8 fixed_point_position) |
Creates an opaque reference to a tensor data buffer. More... | |
VX_API_ENTRY vx_status VX_API_CALL | vxCopyTensorPatch (vx_tensor tensor, vx_size number_of_dims, const vx_size *view_start, const vx_size *view_end, const vx_size *user_stride, void *user_ptr, vx_enum usage, vx_enum user_memory_type) |
Allows the application to copy a view patch from/into an tensor object . More... | |
VX_API_ENTRY vx_status VX_API_CALL | vxQueryTensor (vx_tensor tensor, vx_enum attribute, void *ptr, vx_size size) |
Retrieves various attributes of a tensor data. More... | |
VX_API_ENTRY vx_status VX_API_CALL | vxSetTensorAttribute (vx_tensor tensor, vx_enum attribute, const void *ptr, vx_size size) |
Sets attributes of a tensor object. More... | |
VX_API_ENTRY vx_status VX_API_CALL | vxReleaseTensor (vx_tensor *tensor) |
Releases a reference to a tensor data object. The object may not be garbage collected until its total reference count is zero. More... | |
VX_API_ENTRY vx_status VX_API_CALL | tivxMapTensorPatch (vx_tensor tensor, vx_size number_of_dims, const vx_size *view_start, const vx_size *view_end, vx_map_id *map_id, vx_size *stride, void **ptr, vx_enum usage, vx_enum mem_type) |
Allows the application to get direct access to a patch of tensor object. More... | |
VX_API_ENTRY vx_status VX_API_CALL | tivxUnmapTensorPatch (vx_tensor tensor, vx_map_id map_id) |
Unmap and commit potential changes to a tensor object patch that were previously mapped. Unmapping a tensor patch invalidates the memory location from which the patch could be accessed by the application. Accessing this memory location after the unmap function completes has an undefined behavior. More... | |
Interface to Tensor APIs (modeled after OpenVX 1.2 tensor support)
Definition in file tivx_tensor.h.
typedef struct _vx_tensor* vx_tensor |
The multidimensional data object (Tensor).
Definition at line 83 of file tivx_tensor.h.
tensor Data attributes.
Definition at line 103 of file tivx_tensor.h.
VX_API_ENTRY vx_tensor VX_API_CALL vxCreateTensor | ( | vx_context | context, |
vx_size | number_of_dims, | ||
const vx_size * | dims, | ||
vx_enum | data_type, | ||
vx_int8 | fixed_point_position | ||
) |
Creates an opaque reference to a tensor data buffer.
Not guaranteed to exist until the vx_graph
containing it has been verified. Since functions using tensors, need to understand the context of each dimension. We describe a layout of the dimensions in each function using tensors. That layout is not mandatory. It is done specifically to explain the functions and not to mandate layout. Different implementation may have different layout. Therefore the layout description is logical and not physical. It refers to the order of dimensions given in this function.
[in] | context | The reference to the implementation context. |
[in] | number_of_dims | The number of dimensions. |
[in] | dims | Dimensions sizes in elements. |
[in] | data_type | The vx_type_e that represents the data type of the tensor data elements. |
[in] | fixed_point_position | Specifies the fixed point position when the input element type is integer. if 0, calculations are performed in integer math. |
vxGetStatus
. VX_API_ENTRY vx_status VX_API_CALL vxCopyTensorPatch | ( | vx_tensor | tensor, |
vx_size | number_of_dims, | ||
const vx_size * | view_start, | ||
const vx_size * | view_end, | ||
const vx_size * | user_stride, | ||
void * | user_ptr, | ||
vx_enum | usage, | ||
vx_enum | user_memory_type | ||
) |
Allows the application to copy a view patch from/into an tensor object .
[in] | tensor | The reference to the tensor object that is the source or the destination of the copy. |
[in] | number_of_dims | Number of patch dimension. Error return if 0 or greater than number of tensor dimensions. If smaller than number of tensor dimensions, the lower dimensions are assumed. |
[in] | view_start | Array of patch start points in each dimension |
[in] | view_end | Array of patch end points in each dimension |
[in] | user_stride | Array of user memory strides in each dimension |
[in] | user_ptr | The address of the memory location where to store the requested data if the copy was requested in read mode, or from where to get the data to store into the tensor object if the copy was requested in write mode. The accessible memory must be large enough to contain the specified patch with the specified layout: accessible memory in bytes >= (end[last_dimension] - start[last_dimension]) * stride[last_dimension]. The layout of the user memory must follow a row major order. |
[in] | usage | This declares the effect of the copy with regard to the tensor object using the vx_accessor_e enumeration. Only VX_READ_ONLY and VX_WRITE_ONLY are supported:
|
[in] | user_memory_type | A vx_memory_type_e enumeration that specifies the memory type of the memory referenced by the user_addr. |
vx_status_e
enumeration. VX_ERROR_OPTIMIZED_AWAY | This is a reference to a virtual tensor that cannot be accessed by the application. |
VX_ERROR_INVALID_REFERENCE | The tensor reference is not actually an tensor reference. |
VX_ERROR_INVALID_PARAMETERS | An other parameter is incorrect. |
VX_API_ENTRY vx_status VX_API_CALL vxQueryTensor | ( | vx_tensor | tensor, |
vx_enum | attribute, | ||
void * | ptr, | ||
vx_size | size | ||
) |
Retrieves various attributes of a tensor data.
[in] | tensor | The reference to the tensor data to query. |
[in] | attribute | The attribute to query. Use a vx_tensor_attribute_e . |
[out] | ptr | The location at which to store the resulting value. |
[in] | size | The size of the container to which ptr points. |
vx_status_e
enumeration. VX_SUCCESS | No errors. |
VX_ERROR_INVALID_REFERENCE | If data is not a vx_tensor . |
VX_ERROR_INVALID_PARAMETERS | If any of the other parameters are incorrect. |
VX_API_ENTRY vx_status VX_API_CALL vxSetTensorAttribute | ( | vx_tensor | tensor, |
vx_enum | attribute, | ||
const void * | ptr, | ||
vx_size | size | ||
) |
Sets attributes of a tensor object.
[in] | tensor | The tensor object to set. |
[in] | attribute | The attribute to modify. Use a vx_tensor_attribute_e enumeration. |
[in] | ptr | The pointer to the value to which to set the attribute. |
[in] | size | The size of the data pointed to by ptr. |
vx_status_e
enumeration. VX_SUCCESS | No errors. |
VX_ERROR_INVALID_REFERENCE | If data is not a vx_tensor . |
VX_ERROR_INVALID_PARAMETERS | If any of the other parameters are incorrect. |
VX_API_ENTRY vx_status VX_API_CALL vxReleaseTensor | ( | vx_tensor * | tensor | ) |
Releases a reference to a tensor data object. The object may not be garbage collected until its total reference count is zero.
[in] | tensor | The pointer to the tensor data to release. |
vx_status_e
enumeration. VX_SUCCESS | No errors; all other values indicate failure |
* | An error occurred. See vx_status_e . |
VX_API_ENTRY vx_status VX_API_CALL tivxMapTensorPatch | ( | vx_tensor | tensor, |
vx_size | number_of_dims, | ||
const vx_size * | view_start, | ||
const vx_size * | view_end, | ||
vx_map_id * | map_id, | ||
vx_size * | stride, | ||
void ** | ptr, | ||
vx_enum | usage, | ||
vx_enum | mem_type | ||
) |
Allows the application to get direct access to a patch of tensor object.
[in] | tensor | The reference to the tensor object that is the source or the destination for direct access. |
[in] | number_of_dims | The number of dimensions. Must be same as tensor number_of_dims. |
[in] | view_start | Array of patch start points in each dimension. This is optional parameter and will be zero when NULL. |
[in] | view_end | Array of patch end points in each dimension. This is optional parameter and will be dims[] of tensor when NULL. |
[out] | map_id | The address of a vx_map_id variable where the function returns a map identifier.
|
[out] | stride | An array of stride in all dimensions in bytes. The stride value at index 0 must be size of the tensor data element type. |
[out] | ptr | The address of a pointer that the function sets to the address where the requested data can be accessed. The returned (*ptr) address is only valid between the call to the function and the corresponding call to tivxUnmapTensorPatch . |
[in] | usage | This declares the access mode for the tensor patch, using the vx_accessor_e enumeration.
|
[in] | mem_type | A vx_memory_type_e enumeration that specifies the type of the memory where the tensor patch is requested to be mapped. |
vx_status_e
enumeration. VX_ERROR_OPTIMIZED_AWAY | This is a reference to a virtual tensor that cannot be accessed by the application. |
VX_ERROR_INVALID_REFERENCE | The tensor reference is not actually an tensor reference. |
VX_ERROR_INVALID_PARAMETERS | An other parameter is incorrect. |
VX_ERROR_NO_MEMORY | Internal memory allocation failed. |
tivxUnmapTensorPatch
with same (*map_id) value. VX_API_ENTRY vx_status VX_API_CALL tivxUnmapTensorPatch | ( | vx_tensor | tensor, |
vx_map_id | map_id | ||
) |
Unmap and commit potential changes to a tensor object patch that were previously mapped. Unmapping a tensor patch invalidates the memory location from which the patch could be accessed by the application. Accessing this memory location after the unmap function completes has an undefined behavior.
[in] | tensor | The reference to the tensor object to unmap. |
[out] | map_id | The unique map identifier that was returned by tivxMapTensorPatch . |
vx_status_e
enumeration. VX_ERROR_INVALID_REFERENCE | The tensor reference is not actually a tensor reference. |
VX_ERROR_INVALID_PARAMETERS | An other parameter is incorrect. |
tivxMapTensorPatch
with same map_id value