Group Tensor#

group ov_tensor_c_api

The definitions & operations about tensor.

Functions

ov_tensor_create_from_host_ptr(const ov_element_type_e type, const ov_shape_t shape, void *host_ptr, ov_tensor_t **tensor)#

Constructs Tensor using element type, shape and external host ptr.

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.

ov_tensor_create(const ov_element_type_e type, const ov_shape_t shape, ov_tensor_t **tensor)#

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_set_shape(ov_tensor_t *tensor, const ov_shape_t 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.

ov_tensor_get_shape(const ov_tensor_t *tensor, ov_shape_t *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.

ov_tensor_get_element_type(const ov_tensor_t *tensor, ov_element_type_e *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.

ov_tensor_get_size(const ov_tensor_t *tensor, size_t *elements_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.

ov_tensor_get_byte_size(const ov_tensor_t *tensor, size_t *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.

ov_tensor_data(const ov_tensor_t *tensor, void **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_free(ov_tensor_t *tensor)#

Free ov_tensor_t.

Parameters:

tensor – A point to ov_tensor_t

struct ov_tensor_t#
#include <ov_tensor.h>

type define ov_tensor_t from ov_tensor