docs.unity3d.com
    Show / Hide Table of Contents

    Interface ITensorAllocator

    An interface that provides methods for allocating tensors.

    Inherited Members
    IDisposable.Dispose()
    Namespace: Unity.Sentis
    Syntax
    public interface ITensorAllocator : IDisposable

    Methods

    Alloc(TensorShape, DataType, DeviceType, AllocScope)

    Allocates a tensor of a given shape, data type on a given device type, and given scope.

    Declaration
    Tensor Alloc(TensorShape shape, DataType dataType, DeviceType deviceType, AllocScope scope = AllocScope.LayerOutput)
    Parameters
    Type Name Description
    TensorShape shape
    DataType dataType
    DeviceType deviceType
    AllocScope scope
    Returns
    Type Description
    Tensor

    Alloc(TensorShape, DataType, ITensorData, AllocScope)

    Allocates a tensor of a given shape, data type, and a given scope from an existing ITensorData buffer.

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

    MoveToDevice(Tensor, ITensorData, ITensorData, Boolean)

    Moves a tensor to a device.

    Declaration
    void MoveToDevice(Tensor x, ITensorData newBuffer, ITensorData oldBuffer, bool disposeDetachedBufferHint)
    Parameters
    Type Name Description
    Tensor x
    ITensorData newBuffer
    ITensorData oldBuffer
    Boolean disposeDetachedBufferHint

    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)

    Releases a tensor.

    Declaration
    void Release(Tensor x, bool calledFromTensorDispose)
    Parameters
    Type Name Description
    Tensor x
    Boolean calledFromTensorDispose

    Reset(Boolean)

    Resets the allocator.

    Declaration
    void Reset(bool keepCachedMemory)
    Parameters
    Type Name Description
    Boolean keepCachedMemory

    WaiveOwnership(Tensor)

    Waives ownership of a tensor.

    Declaration
    void WaiveOwnership(Tensor x)
    Parameters
    Type Name Description
    Tensor x
    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