TensorInfo

class TensorInfo(info: Optional[TensorInfo] = None)

Represents information about a tensor, including its shape, data type, memory layout, and other relevant attributes. This class provides methods to retrieve tensor information.

Attributes:
  • tcim_numpy_map (dict) -- The supported data types of the tensor in the current TensorInfo object.

    • pytcim.INT8: np.int8

    • pytcim.UINT8: np.uint8

    • pytcim.INT16: np.int16

    • pytcim.UINT16: np.uint16

    • pytcim.INT32: np.int32

    • pytcim.UINT32: np.uint32

    • pytcim.FLOAT16: np.float16

    • pytcim.FLOAT32: np.float32

  • numpy_tcim_map (dict) -- The supported target data types that the tensor of the current TensorInfo object can be converted to.

    • np.int8: pytcim.INT8

    • np.uint8: pytcim.UINT8

    • np.int16: pytcim.INT16

    • np.uint16: pytcim.UINT16

    • np.int32: pytcim.INT32

    • np.uint32: pytcim.UINT32

    • np.float16: pytcim.FLOAT16

    • np.float32: pytcim.FLOAT32

Constructor for the TensorInfo class.

Methods

__init__

Constructor for the TensorInfo class.

ascontiguous

Creates a TensorInfo object with updated memory layout information to contiguous for the tensor.

astype

Updates the data type of the tensor in the current TensorInfo object.

create_nd

Creates a TensorInfo object for a non-image (ND) tensor with the specified shape, data type, and stride.

create_yuv

Creates a TensorInfo object for a YUV image with the specified batch size, width, height, and format.

dtype

Retrieves the data type of the tensor associated with the current TensorInfo object.

format

Retrieves the data format of the tensor associated with the current TensorInfo object.

is_contiguous

Checks if the tensor data associated with the current TensorInfo has a contiguous memory layout.

mem_size

Retrieves the memory size (in bytes) allocated for the tensor associated with the current TensorInfo object.

merge_yuv

Creates a TensorInfo object for a merged YUV tensor with the given tensor information of Y tensor (Y component) and UV tensor (UV component).

shape

Retrieves the shape of the tensor associated with the current TensorInfo object.

stride

Retrieves the stride of the tensor associated with the current TensorInfo object.