docs.unity3d.com
    Show / Hide Table of Contents

    Interface ITensorAllocator

    Interfaces for tensor allocator

    Namespace: Unity.Barracuda
    Syntax
    public interface ITensorAllocator : IDisposable

    Methods

    Alloc(TensorShape, AllocScope)

    Allocate

    Declaration
    Tensor Alloc(TensorShape shape, AllocScope scope = AllocScope.LayerOutput)
    Parameters
    Type Name Description
    TensorShape shape

    shape

    AllocScope scope

    tensor lifetime scope

    Returns
    Type Description
    Tensor

    allocated Tensor

    Alloc(TensorShape, ITensorData, AllocScope)

    Allocate with existing ITensorData buffer

    Declaration
    Tensor Alloc(TensorShape shape, ITensorData buffer, AllocScope scope = AllocScope.LayerOutput)
    Parameters
    Type Name Description
    TensorShape shape

    shape

    ITensorData buffer

    buffer

    AllocScope scope

    tensor lifetime scope

    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

    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, 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

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023