CoreFlow 1.0.0
A modern orchestration and execution runtime
Loading...
Searching...
No Matches
coreflow::Tensor Class Reference

#include <vx_tensor.h>

Inheritance diagram for coreflow::Tensor:
coreflow::Reference

Public Member Functions

 Tensor (vx_context context, vx_reference reference)
 Construct a new Tensor object.
 
 ~Tensor ()
 Destroy the Tensor object.
 
void * allocateTensorMemory ()
 Allocate tensor memory.
 
void 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.
 
const vx_sizedims () const
 Get the dimensions of the tensor.
 
vx_size numDims () const
 Get the number of dimensions in the tensor.
 
vx_enum dataType () const
 Get the data type of the tensor.
 
vx_int8 fixedPointPosition () const
 Get the fixed point position of the tensor.
 
const vx_sizestrides () const
 Get the strides of the tensor.
 
vx_size size () const
 Get the size of the tensor in bytes.
 
vx_status 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 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 unmapPatch (vx_map_id map_id)
 Unmap a patch of the tensor.
 
void destruct () override final
 Function to destroy tensor obj.
 
vx_uint32 refCount () const
 Returns the reference count of the object.
 
const vx_charrefName () const
 Returns the name of the reference.
 
void setName (const vx_char *name)
 Sets the name of the reference.
 
vx_uint32 incrementReference (vx_reftype_e refType)
 Increments the ref count.
 
vx_uint32 decrementReference (vx_reftype_e refType)
 Decrements the ref count.
 
vx_uint32 totalReferenceCount ()
 Returns the total reference count of the object.
 
void initReferenceForDelay (vx_delay delay, vx_int32 index)
 Used to initialize any vx_reference as a delay element.
 

Static Public Member Functions

static vx_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 isValidTensor (vx_tensor tensor)
 Used to validate the vx_tensor types.
 
static vx_int32 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 computePatchSize (const vx_size *view_start, const vx_size *view_end, vx_size number_of_dimensions)
 Compute patch size.
 
static void 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.
 
static vx_reference createReference (vx_context context, vx_enum type, vx_reftype_e refType, vx_reference scope)
 Used to create a reference.
 
static void printReference (vx_reference ref)
 Prints the values of a reference.
 
static vx_bool isValidReference (vx_reference ref)
 Used to validate everything but vx_context, vx_image and vx_buffer.
 
static vx_bool isValidReference (vx_reference ref, vx_enum type)
 Used to validate everything but vx_context, vx_image and vx_buffer.
 
static vx_size sizeOfType (vx_enum type)
 Returns the number of bytes in the internal structure for a given type.
 
static vx_status releaseReference (vx_reference *ref, vx_enum type, vx_reftype_e reftype, vx_destructor_f special_destructor)
 Used to destroy a reference.
 

Public Attributes

void * addr
 The memory layout definition.
 
vx_uint32 number_of_dimensions
 Number of dimensions.
 
vx_size dimensions [VX_MAX_TENSOR_DIMENSIONS]
 Size of all dimensions.
 
vx_size stride [VX_MAX_TENSOR_DIMENSIONS]
 Stride of all dimensions.
 
vx_enum data_type
 Type of data element.
 
vx_int8 fixed_point_position
 Fixed point position.
 
vx_tensor subtensors [VX_INT_MAX_REF]
 Array of subtensors.
 
vx_tensor parent
 A pointer to a parent md data object.
 
vx_image subimages [VX_INT_MAX_REF]
 Array of subimages.
 
struct _vx_platform * platform
 Platform for ICD compatibility.
 
vx_uint32 magic
 Used to validate references, must be set to VX_MAGIC.
 
vx_enum type
 Set to an enum value in vx_type_e.
 
vx_context context
 Pointer to the top level context. If this reference is the context, this will be NULL.
 
vx_reference scope
 The pointer to the object's scope parent. When virtual objects are scoped within a graph, this will point to that parent graph. This is left generic to allow future scoping variations. By default scope should be the same as context.
 
vx_uint32 external_count
 The count of the number of users with this reference. When greater than 0, this can not be freed. When zero, the value can be considered inaccessible.
 
vx_uint32 internal_count
 The count of the number of framework references. When greater than 0, this can not be freed.
 
vx_uint32 read_count
 The number of times the object has been read (in some portion)
 
vx_uint32 write_count
 The number of times the object has been written to (in some portion)
 
vx_sem_t lock
 The reference lock which is used to protect access to "in-fly" data.
 
void * reserved
 A reserved field which can be used to store anonymous data.
 
vx_uint32 index
 A field which can be used to store a temporary, per-graph index.
 
vx_bool extracted
 This indicates if the object was extracted from another object.
 
vx_bool is_virtual
 This indicates if the object is virtual or not.
 
vx_delay delay
 
vx_int32 delay_slot_index
 
vx_bool is_accessible
 This indicates that if the object is virtual whether it is accessible at the moment or not.
 
vx_char name [VX_MAX_REFERENCE_NAME]
 The reference name.
 

Member Data Documentation

◆ addr

void* coreflow::Tensor::addr

The memory layout definition.

◆ context

vx_context coreflow::Reference::context
inherited

Pointer to the top level context. If this reference is the context, this will be NULL.

◆ data_type

vx_enum coreflow::Tensor::data_type

Type of data element.

◆ delay

vx_delay coreflow::Reference::delay
inherited

◆ delay_slot_index

vx_int32 coreflow::Reference::delay_slot_index
inherited

◆ dimensions

vx_size coreflow::Tensor::dimensions[VX_MAX_TENSOR_DIMENSIONS]

Size of all dimensions.

◆ external_count

vx_uint32 coreflow::Reference::external_count
inherited

The count of the number of users with this reference. When greater than 0, this can not be freed. When zero, the value can be considered inaccessible.

◆ extracted

vx_bool coreflow::Reference::extracted
inherited

This indicates if the object was extracted from another object.

◆ fixed_point_position

vx_int8 coreflow::Tensor::fixed_point_position

Fixed point position.

◆ index

vx_uint32 coreflow::Reference::index
inherited

A field which can be used to store a temporary, per-graph index.

◆ internal_count

vx_uint32 coreflow::Reference::internal_count
inherited

The count of the number of framework references. When greater than 0, this can not be freed.

◆ is_accessible

vx_bool coreflow::Reference::is_accessible
inherited

This indicates that if the object is virtual whether it is accessible at the moment or not.

◆ is_virtual

vx_bool coreflow::Reference::is_virtual
inherited

This indicates if the object is virtual or not.

◆ lock

vx_sem_t coreflow::Reference::lock
inherited

The reference lock which is used to protect access to "in-fly" data.

◆ magic

vx_uint32 coreflow::Reference::magic
inherited

Used to validate references, must be set to VX_MAGIC.

◆ name

vx_char coreflow::Reference::name[VX_MAX_REFERENCE_NAME]
inherited

The reference name.

◆ number_of_dimensions

vx_uint32 coreflow::Tensor::number_of_dimensions

Number of dimensions.

◆ parent

vx_tensor coreflow::Tensor::parent

A pointer to a parent md data object.

◆ platform

struct _vx_platform* coreflow::Reference::platform
inherited

Platform for ICD compatibility.

◆ read_count

vx_uint32 coreflow::Reference::read_count
inherited

The number of times the object has been read (in some portion)

◆ reserved

void* coreflow::Reference::reserved
inherited

A reserved field which can be used to store anonymous data.

◆ scope

vx_reference coreflow::Reference::scope
inherited

The pointer to the object's scope parent. When virtual objects are scoped within a graph, this will point to that parent graph. This is left generic to allow future scoping variations. By default scope should be the same as context.

◆ stride

vx_size coreflow::Tensor::stride[VX_MAX_TENSOR_DIMENSIONS]

Stride of all dimensions.

◆ subimages

vx_image coreflow::Tensor::subimages[VX_INT_MAX_REF]

Array of subimages.

◆ subtensors

vx_tensor coreflow::Tensor::subtensors[VX_INT_MAX_REF]

Array of subtensors.

◆ type

vx_enum coreflow::Reference::type
inherited

Set to an enum value in vx_type_e.

◆ write_count

vx_uint32 coreflow::Reference::write_count
inherited

The number of times the object has been written to (in some portion)