docs.unity3d.com
    Show / Hide Table of Contents

    Class BurstTensorData

    Represents Burst-specific internal data storage for a Tensor.

    Inheritance
    Object
    BurstTensorData
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.Sentis
    Syntax
    public class BurstTensorData : ITensorData, IDisposable, IDependableMemoryResource, IConvertibleToComputeTensorData, IConvertibleToArrayTensorData

    Constructors

    BurstTensorData(ArrayTensorData)

    Initializes and returns an instance of BurstTensorData from an ArrayTensorData.

    Declaration
    public BurstTensorData(ArrayTensorData sharedArray)
    Parameters
    Type Name Description
    ArrayTensorData sharedArray

    The ArrayTensorData to convert.

    BurstTensorData(SharedArrayTensorData)

    Initializes and returns an instance of BurstTensorData from a SharedArrayTensorData.

    Declaration
    public BurstTensorData(SharedArrayTensorData sharedArray)
    Parameters
    Type Name Description
    SharedArrayTensorData sharedArray

    The SharedArrayTensorData to convert.

    BurstTensorData(TensorShape, Array)

    Initializes and returns an instance of BurstTensorData from a TensorShape and an Array.

    Declaration
    public BurstTensorData(TensorShape shape, Array data)
    Parameters
    Type Name Description
    TensorShape shape

    The shape of the tensor data.

    Array data

    The values of the tensor data as an Array.

    BurstTensorData(TensorShape, Boolean)

    Initializes and returns an instance of BurstTensorData, and allocates storage for a tensor with the shape of shape.

    Declaration
    public BurstTensorData(TensorShape shape, bool clearOnInit = true)
    Parameters
    Type Name Description
    TensorShape shape

    The shape of the tensor data to allocate.

    Boolean clearOnInit

    Whether to zero the data on allocation. The default value is true.

    BurstTensorData(TensorShape, NativeTensorArray, Int32)

    Initializes and returns an instance of BurstTensorData from a NativeTensorArray and an offset.

    Declaration
    public BurstTensorData(TensorShape shape, NativeTensorArray data, int offset = 0)
    Parameters
    Type Name Description
    TensorShape shape

    The shape of the tensor data.

    NativeTensorArray data

    The values of the tensor data as a NativeTensorArray.

    Int32 offset

    The integer offset for the backing data.

    Properties

    array

    The NativeTensorArray managed array containing the Tensor data.

    Declaration
    public NativeTensorArray array { get; }
    Property Value
    Type Description
    NativeTensorArray

    count

    The length of the tensor using this data.

    Declaration
    public int count { get; }
    Property Value
    Type Description
    Int32

    deviceType

    On what device backend are the data elements stored

    Declaration
    public virtual DeviceType deviceType { get; }
    Property Value
    Type Description
    DeviceType
    Implements
    ITensorData.deviceType

    fence

    A read fence job handle. You can use fence as a dependsOn argument when you schedule a job that reads data. The job will start when the tensor data is ready for read access.

    Declaration
    public JobHandle fence { get; set; }
    Property Value
    Type Description
    JobHandle
    Implements
    IDependableMemoryResource.fence

    maxCapacity

    The maximum count of the stored data elements.

    Declaration
    public int maxCapacity { get; }
    Property Value
    Type Description
    Int32
    Implements
    ITensorData.maxCapacity

    offset

    The integer offset for the backing data.

    Declaration
    public int offset { get; }
    Property Value
    Type Description
    Int32

    rawPtr

    The raw memory pointer for the resource.

    Declaration
    public void *rawPtr { get; }
    Property Value
    Type Description
    Void*
    Implements
    IDependableMemoryResource.rawPtr

    reuse

    A write fence job handle. You can use reuse as a dependsOn argument when you schedule a job that reads data. The job will start when the tensor data is ready for write access.

    Declaration
    public JobHandle reuse { get; set; }
    Property Value
    Type Description
    JobHandle
    Implements
    IDependableMemoryResource.reuse

    shape

    The shape of the tensor using this data as a TensorShape.

    Declaration
    public TensorShape shape { get; }
    Property Value
    Type Description
    TensorShape

    Methods

    ConvertToArrayTensorData(TensorShape)

    Implement this method to convert to ArrayTensorData.

    Declaration
    public ArrayTensorData ConvertToArrayTensorData(TensorShape shape)
    Parameters
    Type Name Description
    TensorShape shape
    Returns
    Type Description
    ArrayTensorData
    Implements
    IConvertibleToArrayTensorData.ConvertToArrayTensorData(TensorShape)

    ConvertToComputeTensorData(TensorShape)

    Implement this method to convert to ComputeTensorData.

    Declaration
    public ComputeTensorData ConvertToComputeTensorData(TensorShape shape)
    Parameters
    Type Name Description
    TensorShape shape
    Returns
    Type Description
    ComputeTensorData
    Implements
    IConvertibleToComputeTensorData.ConvertToComputeTensorData(TensorShape)

    Dispose()

    Disposes of the BurstTensorData and any associated memory.

    Declaration
    public void Dispose()
    Implements
    IDisposable.Dispose()

    Download<T>(Int32, Int32)

    Returns data from internal storage.

    Declaration
    public T[] Download<T>(int dstCount, int srcOffset = 0)
        where T : struct
    Parameters
    Type Name Description
    Int32 dstCount
    Int32 srcOffset
    Returns
    Type Description
    T[]
    Type Parameters
    Name Description
    T
    Implements
    ITensorData.Download<T>(Int32, Int32)

    Finalize()

    Finalizes the BurstTensorData.

    Declaration
    protected void Finalize()

    Pin(Tensor, Boolean)

    Moves a tensor into memory on the CPU backend device.

    Declaration
    public static BurstTensorData Pin(Tensor X, bool uploadCache = true)
    Parameters
    Type Name Description
    Tensor X

    The Tensor to move to the CPU.

    Boolean uploadCache

    Whether to also move the existing tensor data to the CPU. The default value is true.

    Returns
    Type Description
    BurstTensorData

    Reserve(Int32)

    Reserves storage for count elements.

    Declaration
    public void Reserve(int count)
    Parameters
    Type Name Description
    Int32 count
    Implements
    ITensorData.Reserve(Int32)

    ScheduleAsyncDownload()

    Schedules asynchronous download of internal data.

    Declaration
    public bool ScheduleAsyncDownload()
    Returns
    Type Description
    Boolean

    true if the download has finished.

    Implements
    ITensorData.ScheduleAsyncDownload()

    SharedAccess(out Int32)

    Returns the backing data and outputs the offset.

    Declaration
    public NativeTensorArray SharedAccess(out int offset)
    Parameters
    Type Name Description
    Int32 offset

    The integer offset in the backing data.

    Returns
    Type Description
    NativeTensorArray

    The internal NativeTensorArray backing data.

    ToString()

    Returns a string that represents the BurstTensorData.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String
    Overrides
    Object.ToString()

    Upload<T>(T[], Int32, Int32)

    Uploads data to internal storage.

    Declaration
    public void Upload<T>(T[] data, int srcCount, int srcOffset = 0)
        where T : struct
    Parameters
    Type Name Description
    T[] data
    Int32 srcCount
    Int32 srcOffset
    Type Parameters
    Name Description
    T
    Implements
    ITensorData.Upload<T>(T[], Int32, Int32)
    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