Tensor¶
Overview¶
The definitions & operations about tensor. More…
// structs
struct ov_tensor_t;
// global functions
const ov_element_type_econst ov_shape_tvoid \*ov_tensor_t \*\* ov_tensor_create_from_host_ptr(
,
,
,
);
const ov_element_type_econst ov_shape_tov_tensor_t \*\* ov_tensor_create(, , );
ov_tensor_t \*const ov_shape_t ov_tensor_set_shape(, );
const ov_tensor_t \*ov_shape_t \* ov_tensor_get_shape(, );
const ov_tensor_t \*ov_element_type_e \* ov_tensor_get_element_type(, );
const ov_tensor_t \*size_t \* ov_tensor_get_size(, );
const ov_tensor_t \*size_t \* ov_tensor_get_byte_size(, );
const ov_tensor_t \*void \*\* ov_tensor_data(, );
ov_tensor_t \* ov_tensor_free();
Detailed Documentation¶
The definitions & operations about tensor.
Global Functions¶
const ov_element_type_econst ov_shape_tvoid \*ov_tensor_t \*\* ov_tensor_create_from_host_ptr(
,
,
,
)
Constructs Tensor using element type and shape. Allocate internal host storage using default allocator.
Parameters:
type |
Tensor element type |
shape |
Tensor shape |
host_ptr |
Pointer to pre-allocated host memory |
tensor |
A point to ov_tensor_t |
Returns:
Status code of the operation: OK(0) for success.
const ov_element_type_econst ov_shape_tov_tensor_t \*\* ov_tensor_create(, , )
Constructs Tensor using element type and shape. Allocate internal host storage using default allocator.
Parameters:
type |
Tensor element type |
shape |
Tensor shape |
tensor |
A point to ov_tensor_t |
Returns:
Status code of the operation: OK(0) for success.
ov_tensor_t \*const ov_shape_t ov_tensor_set_shape(, )
Set new shape for tensor, deallocate/allocate if new total size is bigger than previous one.
Parameters:
shape |
Tensor shape |
tensor |
A point to ov_tensor_t |
Returns:
Status code of the operation: OK(0) for success.
const ov_tensor_t \*ov_shape_t \* ov_tensor_get_shape(, )
Get shape for tensor.
Parameters:
shape |
Tensor shape |
tensor |
A point to ov_tensor_t |
Returns:
Status code of the operation: OK(0) for success.
const ov_tensor_t \*ov_element_type_e \* ov_tensor_get_element_type(, )
Get type for tensor.
Parameters:
type |
Tensor element type |
tensor |
A point to ov_tensor_t |
Returns:
Status code of the operation: OK(0) for success.
const ov_tensor_t \*size_t \* ov_tensor_get_size(, )
the total number of elements (a product of all the dims or 1 for scalar).
Parameters:
elements_size |
number of elements |
tensor |
A point to ov_tensor_t |
Returns:
Status code of the operation: OK(0) for success.
const ov_tensor_t \*size_t \* ov_tensor_get_byte_size(, )
the size of the current Tensor in bytes.
Parameters:
byte_size |
the size of the current Tensor in bytes. |
tensor |
A point to ov_tensor_t |
Returns:
Status code of the operation: OK(0) for success.
const ov_tensor_t \*void \*\* ov_tensor_data(, )
Provides an access to the underlaying host memory.
Parameters:
data |
A point to host memory. |
tensor |
A point to ov_tensor_t |
Returns:
Status code of the operation: OK(0) for success.
ov_tensor_t \* ov_tensor_free()
Free ov_tensor_t.
Parameters:
tensor |
A point to ov_tensor_t |