docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface ITensorAllocator

    Interfaces for tensor allocator

    Inherited Members
    IDisposable.Dispose()
    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
    TensorShape shape

    shape

    AllocScope scope

    tensor lifetime scope

    DataType 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
    TensorShape shape

    shape

    ITensorData buffer

    buffer

    AllocScope scope

    tensor lifetime scope

    DataType 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

    ITensorData newBuffer

    new buffer

    ITensorData 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
    Type Name Description
    Tensor x

    Tensor

    bool calledFromTensorDispose

    called from tensor dispose flag

    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

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)