Interface IReadableTensorData
An interface that represents tensor data that can be read to and written from on CPU.
Namespace: Unity.Sentis
Assembly: Unity.Sentis.dll
Syntax
public interface IReadableTensorData
Methods
GetReadOnlyNativeArrayHandle<T>(int, int)
Returns a ReadOnlyNativeArray handle on the linear memory data.
Declaration
NativeArray<T>.ReadOnly GetReadOnlyNativeArrayHandle<T>(int dstCount, int srcOffset = 0) where T : unmanaged
Parameters
Type | Name | Description |
---|---|---|
int | dstCount | The number of elements in the array. |
int | srcOffset | The index of the first element in the data. |
Returns
Type | Description |
---|---|
NativeArray<T>.ReadOnly | NativeArray of elements. |
Type Parameters
Name | Description |
---|---|
T | The data type of the elements. |
Get<T>(int)
Returns a data element.
Declaration
T Get<T>(int index) where T : unmanaged
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the element. |
Returns
Type | Description |
---|---|
T | Data element. |
Type Parameters
Name | Description |
---|---|
T | The data type of the element. |
Set<T>(int, T)
Sets value
data element at index
.
Declaration
void Set<T>(int index, T value) where T : unmanaged
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the element to set. |
T | value | The value to set for the element. |
Type Parameters
Name | Description |
---|---|
T | The data type of the element. |
ToArray<T>(int, int)
Returns an array that is a copy of the linear memory data.
Declaration
T[] ToArray<T>(int dstCount, int srcOffset = 0) where T : unmanaged
Parameters
Type | Name | Description |
---|---|---|
int | dstCount | The number of elements in the array. |
int | srcOffset | The index of the first element in the data. |
Returns
Type | Description |
---|---|
T[] | Array of elements. |
Type Parameters
Name | Description |
---|---|
T | The data type of the elements. |
ToReadOnlySpan<T>(int, int)
Returns a ReadOnlySpan on the linear memory data.
Declaration
ReadOnlySpan<T> ToReadOnlySpan<T>(int dstCount, int srcOffset = 0) where T : unmanaged
Parameters
Type | Name | Description |
---|---|---|
int | dstCount | The number of elements to span. |
int | srcOffset | The index of the first element in the data. |
Returns
Type | Description |
---|---|
ReadOnlySpan<T> | Span of elements. |
Type Parameters
Name | Description |
---|---|
T | The data type of the elements. |