Class TensorByte
Represents data in a multidimensional array-like structure.
Ownership and lifetime:
- Disposed needs to be called on the main thread.
- Ownership is always to the owner of the object.
Data Representation:
- TensorShape represents the data layout of the tensor
- Data is held by a tensorData (ITensorData) which can be on a given backend
- Data is stored in a flattened row major format
- Data can be pending (ie computation is being done in parallel)
- call CompleteAllPendingOperations for a blocking call to finish computing the tensor's data Data can be in a non readable type (GPU/NPU)
- Call CompleteAllPendingOperations to finish computing the tensor's data
- Call ReadbackAndClone or ReadBackAndCloneAsync to allow reading the tensor's data
Data manipulation
- ToReadOnlyArray returns a copy of the tensor's data
- dataOnBackend can be manipulated directly to avoid a unnecessary copy see ComputeTensorData/BurstTensorData for info
Implements
Inherited Members
Namespace: Unity.Sentis
Assembly: Unity.Sentis.dll
Syntax
public class TensorByte : Tensor, IDisposable
Properties
count
The length of the tensor.
Declaration
public override int count { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
dataType
The data type of the elements of the tensor.
Declaration
public override DataType dataType { get; }
Property Value
Type | Description |
---|---|
DataType |
Overrides
Methods
AllocZeros(TensorShape)
Initializes and returns a tensor with the specified shape
and filled with 0
.
Declaration
public static TensorByte AllocZeros(TensorShape shape)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape | The shape of the tensor. |
Returns
Type | Description |
---|---|
TensorByte | The instantiated zero tensor. |