Tensor
_class _Tensor(info : Optional[TensorInfo] = None, array : Optional[ndarray] = None, tensor : Optional[Tensor] = None)
Represents an input, output, or intermediate computation result.
Constructor for the Tensor class.
Parameters:
-
info (TensorInfo object) -- The information of the tensor.
-
array (numpy.ndarray) -- The data of the tensor.
-
tensor (pytcim.Tensor) -- The existed pytcim tensor.
Infoandarraywill be ignored when tensor is set.
Methods
__init__ | Constructor for the Tensor class. |
|---|---|
as_formular | Creates a new Tensor object with normalized TensorInfo. |
astype | Creates a new tensor with the specified target data type, and optionally casts the data of original tensor with the target data type, stores casted data in the new tenor. |
buffer | Retrieves the buffer that holds the data of the tensor. |
cast | Creates a new tensor with the specified target data type, and optionally casts the data of original tensor with the target data type, stores casted data in the new tenor. |
cast_to | Converts tensor data to special data type. |
clone | Allocates memory for a new current Tensor object that is a copy of the current Tensor object if auto_copy is true. |
copy_to | Copies the tensor data of the current Tensor object to another Tensor object. |
device | Retrieves the device type on which the tensor data is stored. |
device_id | Retrieves the logical ID of the Houmo device on which the tensor is stored. |
info | Retrieves the information of the tensor associated with the current Tensor object. |
mem_size | Retrieves the actual allocated memory size for the tensor. |
numpy | Retrieves the data of the tensor. |
select_batch | Selects a batch of elements along the batch dimension from the original Tensor object, and returns a new Tensor object that shares the underlying memory with the original Tensor object. |
select_roi | Selects a Region of Interest (ROI) from the current tensor and returns a new Tensor object that shares the underlying memory with the original Tensor object. |
set_zero | Zeros all elements of the tensor in-place. |
split_yuv | Splits a YUV-formatted tensor into separate Y and UV tensors without additional memory allocation. |
to_host | Retrieves or creates a tensor in host memory with tensor data based on the current Tensor object. |