Class UnsafeArrayTensorData
Tensor data storage based on unsafe array
Inherited Members
Namespace: Unity.Barracuda
Syntax
public class UnsafeArrayTensorData : SharedArrayTensorData, ITensorData, IDisposable, ITensorDataStatistics, IUniqueResource
Constructors
UnsafeArrayTensorData(Int32)
Create UnsafeArrayTensorData with new array
Declaration
public UnsafeArrayTensorData(int count)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | count | element count to reserve |
UnsafeArrayTensorData(Single[], Int32, Int32, Boolean)
Create UnsafeArrayTensorData from supplied array
Declaration
protected UnsafeArrayTensorData(float[] data, int offset = 0, int count = null, bool isReadonly = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Single[] | data | data |
| Int32 | offset | offset in |
| Int32 | count | element count |
| Boolean | isReadonly | read-only flag |
UnsafeArrayTensorData(ArrayTensorData)
Create UnsafeArrayTensorData and use shared array
Declaration
public UnsafeArrayTensorData(ArrayTensorData sharedArray)
Parameters
| Type | Name | Description |
|---|---|---|
| ArrayTensorData | sharedArray | shared array |
UnsafeArrayTensorData(SharedArrayTensorData)
Create UnsafeArrayTensorData and use shared array
Declaration
public UnsafeArrayTensorData(SharedArrayTensorData sharedArray)
Parameters
| Type | Name | Description |
|---|---|---|
| SharedArrayTensorData | sharedArray | shared array |
UnsafeArrayTensorData(TensorShape)
Create UnsafeArrayTensorData with new array
Declaration
public UnsafeArrayTensorData(TensorShape shape)
Parameters
| Type | Name | Description |
|---|---|---|
| TensorShape | shape | shape |
Methods
Dispose()
Dispose
Declaration
public override void Dispose()
Overrides
Download(TensorShape)
Returns an array filled with the values of a tensor.
Depending on the implementation and underlying device this array might be a copy or direct reference to the tensor values.
This is a blocking call, unless data from device was requested via ScheduleAsyncDownload beforehand and has already arrived.
Declaration
public override float[] Download(TensorShape shape)
Parameters
| Type | Name | Description |
|---|---|---|
| TensorShape | shape | the TensorShape (and thus length) of the data to copy |
Returns
| Type | Description |
|---|---|
| Single[] | Tensor data as |
Overrides
Finalize()
Finalizer
Declaration
protected void Finalize()
Reserve(Int32)
Reserve uninitialized memory.
Declaration
public override void Reserve(int count)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | count | element count to reserve |
Overrides
ToString()
Summary
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| String | summary |
Overrides
Upload(Single[], TensorShape, Int32)
Initialize with data.
shape is the TensorShape (and thus length) of the data to copy.
managedBufferStartIndex is the offset where to start the copy in the data
Declaration
public override void Upload(float[] data, TensorShape shape, int managedBufferStartIndex = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| Single[] | data | data as |
| TensorShape | shape | Tensor shape |
| Int32 | managedBufferStartIndex | managed buffer start index |