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
Constructor for the Tensor class.
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.
Retrieves the buffer that holds the data of the tensor.
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.
Converts tensor data to special data type.
Allocates memory for a new current
Tensorobject that is a copy of the currentTensorobject ifauto_copyis true.Copies the tensor data of the current
Tensorobject to anotherTensorobject.Retrieves the device type on which the tensor data is stored.
Retrieves the logical ID of the Houmo device on which the tensor is stored.
Retrieves the information of the tensor associated with the current
Tensorobject.Retrieves the data of the tensor.
Selects a batch of elements along the batch dimension from the original
Tensorobject, and returns a newTensorobject that shares the underlying memory with the originalTensorobject.Splits a YUV-formatted tensor into separate Y and UV tensors without additional memory allocation.
Retrieves or creates a tensor in host memory with tensor data based on the current Tensor object.