Interface ITensorAllocator
Interfaces for tensor allocator
Inherited Members
Namespace: Unity.Barracuda
Assembly: solution.dll
Syntax
public interface ITensorAllocator : IDisposable
Methods
Alloc(TensorShape, AllocScope, DataType)
Allocate
Declaration
Tensor Alloc(TensorShape shape, AllocScope scope = AllocScope.LayerOutput, DataType dataType = DataType.Float)
Parameters
Type | Name | Description |
---|---|---|
Tensor |
shape | shape |
Alloc |
scope | tensor lifetime scope |
Data |
dataType | tensor data type |
Returns
Type | Description |
---|---|
Tensor | allocated Tensor |
Alloc(TensorShape, ITensorData, AllocScope, DataType)
Allocate with existing ITensorData
buffer
Declaration
Tensor Alloc(TensorShape shape, ITensorData buffer, AllocScope scope = AllocScope.LayerOutput, DataType dataType = DataType.Float)
Parameters
Type | Name | Description |
---|---|---|
Tensor |
shape | shape |
ITensor |
buffer | buffer |
Alloc |
scope | tensor lifetime scope |
Data |
dataType |
Returns
Type | Description |
---|---|
Tensor | allocated Tensor |
MoveToDevice(Tensor, ITensorData, ITensorData, bool)
Move Tensor to device
Declaration
void MoveToDevice(Tensor x, ITensorData newBuffer, ITensorData oldBuffer, bool disposeDetachedBufferHint)
Parameters
Type | Name | Description |
---|---|---|
Tensor | x | Tensor |
ITensor |
newBuffer | new buffer |
ITensor |
oldBuffer | old buffer |
bool | disposeDetachedBufferHint | dispose detached buffer hint |
PostLayerCleanup()
Allows ITensorAllocator to run cleanup operations such as clearing temporary buffers only used in the scope of the last layer executed.
Declaration
void PostLayerCleanup()
Release(Tensor, bool)
Release Tensor
Declaration
void Release(Tensor x, bool calledFromTensorDispose)
Parameters
Reset(bool)
Reset allocator
Declaration
void Reset(bool keepCachedMemory)
Parameters
Type | Name | Description |
---|---|---|
bool | keepCachedMemory | keep cached memory flag |
WaiveOwnership(Tensor)
Waive ownership
Declaration
void WaiveOwnership(Tensor x)
Parameters
Type | Name | Description |
---|---|---|
Tensor | x | Tensor |