Class TextureTensorData
Represents the data storage for a 'Tensor' as a render texture, for backends that use GPU pixel shaders.
Sentis packs the tensor data into the pixels of an RGBA float4 texture.
Sentis chooses a single tensor dimension as the blocked axis, across which data is chunked in float4 blocks.
Tensor dimensions don't map directly to texture dimensions. Sentis creates the texture with dimensions large enough to fit all the data and pixel shaders index the data based on both the tensor and texture dimensions (see example below).
Inherited Members
Namespace: Unity.Sentis
Assembly: solution.dll
Syntax
public class TextureTensorData : ITensorData, IDisposable
Constructors
Name | Description |
---|---|
TextureTensorData(DataType, TensorShape, int, bool) | Initializes and returns an instance of |
Properties
Name | Description |
---|---|
blockAxis | Returns the axis of the tensor which is blocked. It is possible to block on negative axes by considering a tensor of shape (d0, d1 ... dn) as one of shape (1, 1, .... 1, d0, d1 ... dn). Thus negative axis values do not count from the back of the shape as elsewhere. |
blockedShape | Returns the shape of the tensor with the blocked axis divided by 4. |
bufferAsTexture | Returns the backing texture storing the tensor data. |
dataType | Returns the data type of the associated tensor. |
deviceType | On what device backend are the data elements stored. |
dimAxis | The size of the blocked axis in the original tensor shape (when not blocked). |
dimAxisDiv4 | The size of the blocked axis in the blocked tensor shape, i.e. dimAxisDiv4 = ceil(dimAxis / 4). |
maxCapacity | The maximum count of the stored data elements. |
shape | Returns the shape of the associated tensor. |
strideAxis | The size of the stride of the blocked axis. |
widthMask | Returns the width of the texture - 1 for efficient masking in shaders. |
widthShift | Returns the power in the power of two width of the backing texture. |
Methods
Name | Description |
---|---|
Clone() | Returns a deep copy of the internal storage. |
CompleteAllPendingOperations() | Blocking call to make sure that internal data is correctly written to and available for CPU read back. |
Dispose() | Disposes of the |
Download<T>(int, int) | Returns a contiguous block of data from internal storage. |
~TextureTensorData() | Finalizes the |
IsReadbackRequestDone() | Checks if asynchronous readback request is done. |
Pin(Tensor, int, bool) | Moves the tensor into GPU memory on the |
ReadbackRequest(Action<bool>) | Schedules asynchronous readback of the internal data. |
ReadbackRequestAsync() | Schedules awaitable asynchronous readback of the internal data. See AsyncReadbackRequest for more info |
Reserve(int) | Reserves memory for |
ToString() | Returns a string that represents the |
Upload<T>(NativeArray<T>, int, int) | Uploads a contiguous block of tensor data to internal storage. |