Interface ITensorAllocator
Interfaces for tensor allocator
Namespace: Unity.Barracuda
Syntax
public interface ITensorAllocator : IDisposable
Methods
Alloc(TensorShape)
Allocate
Declaration
Tensor Alloc(TensorShape shape)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape | shape |
Returns
Type | Description |
---|---|
Tensor | allocated Tensor |
Alloc(TensorShape, ITensorData)
Allocate with existing ITensorData
buffer
Declaration
Tensor Alloc(TensorShape shape, ITensorData buffer)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape | shape |
ITensorData | buffer | buffer |
Returns
Type | Description |
---|---|
Tensor | allocated Tensor |
MoveToDevice(Tensor, ITensorData, ITensorData, Boolean)
Move Tensor to device
Declaration
void MoveToDevice(Tensor x, ITensorData newBuffer, ITensorData oldBuffer, bool disposeDetachedBufferHint)
Parameters
Type | Name | Description |
---|---|---|
Tensor | x | Tensor |
ITensorData | newBuffer | new buffer |
ITensorData | oldBuffer | old buffer |
Boolean | disposeDetachedBufferHint | dispose detached buffer hint |
Release(Tensor, Boolean)
Release Tensor
Declaration
void Release(Tensor x, bool calledFromTensorDispose)
Parameters
Type | Name | Description |
---|---|---|
Tensor | x | Tensor |
Boolean | calledFromTensorDispose | called from tensor dispose flag |
Reset(Boolean)
Reset allocator
Declaration
void Reset(bool keepCachedMemory)
Parameters
Type | Name | Description |
---|---|---|
Boolean | keepCachedMemory | keep cached memory flag |
WaiveOwnership(Tensor)
Waive ownership
Declaration
void WaiveOwnership(Tensor x)
Parameters
Type | Name | Description |
---|---|---|
Tensor | x | Tensor |