docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class BurstTensorData

    Represents Burst-specific internal data storage for a Tensor.

    Inheritance
    object
    BurstTensorData
    Implements
    ITensorData
    IDisposable
    IDependableMemoryResource
    IConvertibleToComputeTensorData
    IReadableTensorData
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.Sentis
    Assembly: Unity.Sentis.dll
    Syntax
    public class BurstTensorData : ITensorData, IDisposable, IDependableMemoryResource, IConvertibleToComputeTensorData, IReadableTensorData

    Constructors

    BurstTensorData(int, bool)

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

    Declaration
    public BurstTensorData(int count, bool clearOnInit = false)
    Parameters
    Type Name Description
    int count

    The number of elements.

    bool clearOnInit

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

    BurstTensorData(NativeTensorArray)

    Initializes and returns an instance of BurstTensorData from a NativeTensorArray.

    Declaration
    public BurstTensorData(NativeTensorArray data)
    Parameters
    Type Name Description
    NativeTensorArray data

    The elements of the tensor data as a NativeTensorArray.

    Properties

    array

    The NativeTensorArray managed array containing the Tensor data.

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

    backendType

    On what backend are the data elements stored.

    Declaration
    public BackendType backendType { get; }
    Property Value
    Type Description
    BackendType

    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

    maxCapacity

    The maximum count of the stored data elements.

    Declaration
    public int maxCapacity { get; }
    Property Value
    Type Description
    int

    rawPtr

    The raw memory pointer for the resource.

    Declaration
    public void* rawPtr { get; }
    Property Value
    Type Description
    void*

    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

    Methods

    Clone()

    Returns a deep copy of the internal storage.

    Declaration
    public ITensorData Clone()
    Returns
    Type Description
    ITensorData

    Cloned internal storage.

    CompleteAllPendingOperations()

    Blocking call to make sure that internal data is correctly written to and available for CPU read back.

    Declaration
    public void CompleteAllPendingOperations()

    ConvertToComputeTensorData(int)

    Implement this method to convert to ComputeTensorData.

    Declaration
    public ComputeTensorData ConvertToComputeTensorData(int count)
    Parameters
    Type Name Description
    int count
    Returns
    Type Description
    ComputeTensorData

    Converted ComputeTensorData.

    Dispose()

    Disposes of the BurstTensorData and any associated memory.

    Declaration
    public void Dispose()

    DownloadAsync<T>(int)

    Awaitable contiguous block of data from internal storage.

    Declaration
    public Awaitable<NativeArray<T>> DownloadAsync<T>(int dstCount) where T : unmanaged
    Parameters
    Type Name Description
    int dstCount

    The number of elements to download.

    Returns
    Type Description
    Awaitable<NativeArray<T>>

    A awaitable native array of downloaded elements.

    Type Parameters
    Name Description
    T

    The data type of the elements.

    Download<T>(int)

    Returns data from internal storage.

    Declaration
    public NativeArray<T> Download<T>(int dstCount) where T : unmanaged
    Parameters
    Type Name Description
    int dstCount

    The number of elements to download.

    Returns
    Type Description
    NativeArray<T>

    The downloaded data as a native array.

    Type Parameters
    Name Description
    T

    The data type of the elements.

    ~BurstTensorData()

    Finalizes the BurstTensorData.

    Declaration
    protected ~BurstTensorData()

    GetReadOnlyNativeArrayHandle<T>(int)

    Returns a ReadOnlyNativeArray handle on the linear memory data.

    Declaration
    public NativeArray<T>.ReadOnly GetReadOnlyNativeArrayHandle<T>(int dstCount) where T : unmanaged
    Parameters
    Type Name Description
    int dstCount

    The number of elements in the array.

    Returns
    Type Description
    NativeArray<T>.ReadOnly

    NativeArray of elements.

    Type Parameters
    Name Description
    T

    The data type of the elements.

    Get<T>(int)

    Returns a data element.

    Declaration
    public T Get<T>(int index) where T : unmanaged
    Parameters
    Type Name Description
    int index

    The index of the element.

    Returns
    Type Description
    T

    Data element.

    Type Parameters
    Name Description
    T

    The data type of the element.

    IsReadbackRequestDone()

    Checks if asynchronous readback request is done.

    Declaration
    public bool IsReadbackRequestDone()
    Returns
    Type Description
    bool

    Whether async readback is successful.

    Pin(Tensor, bool)

    Moves a tensor into memory on the CPU backend device.

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

    The Tensor to move to the CPU.

    bool clearOnInit

    Whether to initialize the backend data. The default value is true.

    Returns
    Type Description
    BurstTensorData

    The pinned BurstTensorData.

    ReadbackRequest()

    Schedules asynchronous readback of the internal data.

    Declaration
    public void ReadbackRequest()

    Set<T>(int, T)

    Sets value data element at index.

    Declaration
    public void Set<T>(int index, T value) where T : unmanaged
    Parameters
    Type Name Description
    int index

    The index of the element to set.

    T value

    The value to set for the element.

    Type Parameters
    Name Description
    T

    The data type of the element.

    ToArray<T>(int)

    Returns an array that is a copy of the linear memory data.

    Declaration
    public T[] ToArray<T>(int dstCount) where T : unmanaged
    Parameters
    Type Name Description
    int dstCount

    The number of elements in the array.

    Returns
    Type Description
    T[]

    Array of elements.

    Type Parameters
    Name Description
    T

    The data type of the elements.

    ToReadOnlySpan<T>(int)

    Returns a ReadOnlySpan on the linear memory data.

    Declaration
    public ReadOnlySpan<T> ToReadOnlySpan<T>(int dstCount) where T : unmanaged
    Parameters
    Type Name Description
    int dstCount

    The number of elements to span.

    Returns
    Type Description
    ReadOnlySpan<T>

    Span of elements.

    Type Parameters
    Name Description
    T

    The data type of the elements.

    ToString()

    Returns a string that represents the BurstTensorData.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    The string summary of the BurstTensorData.

    Overrides
    object.ToString()

    Upload<T>(NativeArray<T>, int)

    Uploads data to internal storage.

    Declaration
    public void Upload<T>(NativeArray<T> data, int srcCount) where T : unmanaged
    Parameters
    Type Name Description
    NativeArray<T> data

    The data to upload as a native array.

    int srcCount

    The number of elements to upload.

    Type Parameters
    Name Description
    T

    The data type of the elements.

    Implements

    ITensorData
    IDisposable
    IDependableMemoryResource
    IConvertibleToComputeTensorData
    IReadableTensorData
    In This Article
    Back to top
    Copyright © 2024 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)