CoreFlow 1.0.0
A modern orchestration and execution runtime
Loading...
Searching...
No Matches
Internal Tensor API

The internal Tensor API. More...

Namespaces

namespace  coreflow
 The internal representation of a vx_array.
 

Enumerations

enum  vx_tensor_attribute_ext_e {
  VX_TENSOR_STRIDE = VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_TENSOR) + 0x4 ,
  VX_TENSOR_TOTAL_SIZE = VX_ATTRIBUTE_BASE(VX_ID_KHRONOS, VX_TYPE_TENSOR) + 0x5
}
 addtitional tensor attributes. More...
 

Functions

 coreflow::Tensor::Tensor (vx_context context, vx_reference reference)
 Construct a new Tensor object.
 
 coreflow::Tensor::~Tensor ()
 Destroy the Tensor object.
 
static vx_tensor coreflow::Tensor::createTensor (vx_context context, vx_size number_of_dims, const vx_size *dims, vx_enum data_type, vx_int8 fixed_point_position)
 Create a tensor object.
 
static vx_bool coreflow::Tensor::isValidTensor (vx_tensor tensor)
 Used to validate the vx_tensor types.
 
void * coreflow::Tensor::allocateTensorMemory ()
 Allocate tensor memory.
 
void coreflow::Tensor::initTensor (const vx_size *dimensions, vx_size number_of_dimensions, vx_enum data_type, vx_int8 fixed_point_position)
 Used to initialize the tensor data structure with the correct.
 
static vx_int32 coreflow::Tensor::checkSizes (vx_size *dimensions, const vx_size *view_start, const vx_size *view_end, vx_size number_of_dimensions)
 Check tensor sizes.
 
static vx_size coreflow::Tensor::computePatchSize (const vx_size *view_start, const vx_size *view_end, vx_size number_of_dimensions)
 Compute patch size.
 
static void coreflow::Tensor::computePositionsFromIndex (vx_size index, const vx_size *start, const vx_size *end, const vx_size *tensor_stride, const vx_size *patch_stride, vx_size number_of_dimensions, vx_size *tensor_pos, vx_size *patch_pos)
 Compute positions from index.
 
const vx_sizecoreflow::Tensor::dims () const
 Get the dimensions of the tensor.
 
vx_size coreflow::Tensor::numDims () const
 Get the number of dimensions in the tensor.
 
vx_enum coreflow::Tensor::dataType () const
 Get the data type of the tensor.
 
vx_int8 coreflow::Tensor::fixedPointPosition () const
 Get the fixed point position of the tensor.
 
const vx_sizecoreflow::Tensor::strides () const
 Get the strides of the tensor.
 
vx_size coreflow::Tensor::size () const
 Get the size of the tensor in bytes.
 
vx_status coreflow::Tensor::copyPatch (vx_size number_of_dimensions, 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)
 Copy a patch of the tensor to/from user memory.
 
vx_status coreflow::Tensor::mapPatch (vx_size number_of_dimensions, 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)
 Map a patch of the tensor to user memory.
 
vx_status coreflow::Tensor::unmapPatch (vx_map_id map_id)
 Unmap a patch of the tensor.
 
void coreflow::Tensor::destruct () override final
 Function to destroy tensor obj.
 

Detailed Description

The internal Tensor API.

Enumeration Type Documentation

◆ vx_tensor_attribute_ext_e

#include <vx_corevx_ext.h>

addtitional tensor attributes.

Enumerator
VX_TENSOR_STRIDE 

tensor strides in each dimension.

VX_TENSOR_TOTAL_SIZE 

tensor total size in bytes.

Function Documentation

◆ allocateTensorMemory()

void * coreflow::Tensor::allocateTensorMemory ( )

#include <vx_tensor.h>

Allocate tensor memory.

Returns
void* pointer to allocated memory

◆ checkSizes()

static vx_int32 coreflow::Tensor::checkSizes ( vx_size * dimensions,
const vx_size * view_start,
const vx_size * view_end,
vx_size number_of_dimensions )
static

#include <vx_tensor.h>

Check tensor sizes.

Parameters
dimensionsdimensions
view_startview start
view_endview end
number_of_dimensionsnumber of dimensions
Returns
vx_int32

◆ computePatchSize()

static vx_size coreflow::Tensor::computePatchSize ( const vx_size * view_start,
const vx_size * view_end,
vx_size number_of_dimensions )
static

#include <vx_tensor.h>

Compute patch size.

Parameters
view_startview start
view_endview end
number_of_dimensionsnumber of dimensions
Returns
vx_size

◆ computePositionsFromIndex()

static void coreflow::Tensor::computePositionsFromIndex ( vx_size index,
const vx_size * start,
const vx_size * end,
const vx_size * tensor_stride,
const vx_size * patch_stride,
vx_size number_of_dimensions,
vx_size * tensor_pos,
vx_size * patch_pos )
static

#include <vx_tensor.h>

Compute positions from index.

Parameters
indexindex
startview start
endview end
tensor_stridetensor stride
patch_stridepatch stride
number_of_dimensionsnumber of dimensions
tensor_postensor position
patch_pospatch position

◆ copyPatch()

vx_status coreflow::Tensor::copyPatch ( vx_size number_of_dimensions,
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 )

#include <vx_tensor.h>

Copy a patch of the tensor to/from user memory.

Parameters
number_of_dimensionsThe number of dimensions in the patch
view_startThe start indices of the patch
view_endThe end indices of the patch
user_strideThe stride in user memory
user_ptrThe pointer to user memory
usageThe usage of the memory (read/write)
user_memory_typeThe type of user memory (host, opencl, etc.)
Returns
vx_status VX_SUCCESS on success, error code otherwise

◆ createTensor()

static vx_tensor coreflow::Tensor::createTensor ( vx_context context,
vx_size number_of_dims,
const vx_size * dims,
vx_enum data_type,
vx_int8 fixed_point_position )
static

#include <vx_tensor.h>

Create a tensor object.

Parameters
contextThe context associated with this obj
number_of_dimsThe number of dimensions of the tensor
dimsThe dimensions of the tensor
data_typeThe data type of the tensor
fixed_point_positionThe fixed point position of the tensor
Returns
vx_tensor The tensor object

◆ dataType()

vx_enum coreflow::Tensor::dataType ( ) const

#include <vx_tensor.h>

Get the data type of the tensor.

Returns
vx_enum The data type of the tensor

◆ destruct()

void coreflow::Tensor::destruct ( )
finaloverridevirtual

#include <vx_tensor.h>

Function to destroy tensor obj.

Reimplemented from coreflow::Reference.

◆ dims()

const vx_size * coreflow::Tensor::dims ( ) const

#include <vx_tensor.h>

Get the dimensions of the tensor.

Returns
const vx_size* The dimensions of the tensor

◆ fixedPointPosition()

vx_int8 coreflow::Tensor::fixedPointPosition ( ) const

#include <vx_tensor.h>

Get the fixed point position of the tensor.

Returns
vx_int8 The fixed point position of the tensor

◆ initTensor()

void coreflow::Tensor::initTensor ( const vx_size * dimensions,
vx_size number_of_dimensions,
vx_enum data_type,
vx_int8 fixed_point_position )

#include <vx_tensor.h>

Used to initialize the tensor data structure with the correct.

Parameters
[in]dimensionsarr of dimensions of tensor.
[in]number_of_dimensionsnumber of tensor dimensions.
[in]data_typedata type of tensor.
[in]fixed_point_positionfixed point position of tensor.

◆ isValidTensor()

static vx_bool coreflow::Tensor::isValidTensor ( vx_tensor tensor)
static

#include <vx_tensor.h>

Used to validate the vx_tensor types.

Parameters
[in]tensorThe vx_tensor to validate.

◆ mapPatch()

vx_status coreflow::Tensor::mapPatch ( vx_size number_of_dimensions,
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 )

#include <vx_tensor.h>

Map a patch of the tensor to user memory.

Parameters
number_of_dimensionsThe number of dimensions in the patch
view_startThe start indices of the patch
view_endThe end indices of the patch
map_idThe map ID for the patch
strideThe stride in the patch
ptrThe pointer to the mapped memory
usageThe usage of the memory (read/write)
mem_typeThe type of memory (host, device, etc.)
Returns
vx_status VX_SUCCESS on success, error code otherwise

◆ numDims()

vx_size coreflow::Tensor::numDims ( ) const

#include <vx_tensor.h>

Get the number of dimensions in the tensor.

Returns
vx_size The number of dimensions

◆ size()

vx_size coreflow::Tensor::size ( ) const

#include <vx_tensor.h>

Get the size of the tensor in bytes.

Returns
vx_size The size of the tensor in bytes

◆ strides()

const vx_size * coreflow::Tensor::strides ( ) const

#include <vx_tensor.h>

Get the strides of the tensor.

Returns
const vx_size* The strides of the tensor

◆ Tensor()

coreflow::Tensor::Tensor ( vx_context context,
vx_reference reference )

#include <vx_tensor.h>

Construct a new Tensor object.

Parameters
contextThe context associated with this obj
referenceThe parent ref of this obj

◆ unmapPatch()

vx_status coreflow::Tensor::unmapPatch ( vx_map_id map_id)

#include <vx_tensor.h>

Unmap a patch of the tensor.

Parameters
map_idThe map ID for the patch
Returns
vx_status VX_SUCCESS on success, error code otherwise

◆ ~Tensor()

coreflow::Tensor::~Tensor ( )

#include <vx_tensor.h>

Destroy the Tensor object.