docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TensorByte

    Represents data in a multidimensional array-like structure.

    Ownership and lifetime:

    • Disposed needs to be called on the main thread.
    • Ownership is always to the owner of the object.

    Data Representation:

    • TensorShape represents the data layout of the tensor
    • Data is held by a tensorData (ITensorData) which can be on a given backend
    • Data is stored in a flattened row major format
    • Data can be pending (ie computation is being done in parallel)
      • call CompleteAllPendingOperations for a blocking call to finish computing the tensor's data
      • call CompleteOperationsAndDownloadAsync/ReadbackRequest for a non blocking call to finish computing the tensor's data Data can be in a non readable type (GPU/NPU)
      • Call CompleteOperationsAndDownload to make the tensor readable (this will fetch the data on the backend and convert it to a readable format)
      • CompleteOperationsAndDownload is a blocking call if called on its own. for a non blocking call, make sure that CompleteOperationsAndDownloadAsync/ReadbackRequest have been called previously you can check that with IsReadbackRequestDone

    Data manipulation

    • ToReadOnlyArray returns a copy of the tensor's data
    • dataOnBackend can be manipulated directly to avoid a unnecessary copy see ComputeTensorData/BurstTensorData for info
    Inheritance
    object
    Tensor
    TensorByte
    Implements
    IDisposable
    Inherited Members
    Tensor.shape
    Tensor.dataOnBackend
    Tensor.backendType
    Tensor.Reshape(TensorShape)
    Tensor.AttachToDevice(ITensorData)
    Tensor.DetachFromDevice(bool)
    Tensor.CompleteOperationsAndDownload()
    Tensor.CompleteOperationsAndDownloadAsync()
    Tensor.IsReadbackRequestDone()
    Tensor.ReadbackRequest(Action<bool>)
    Tensor.ReadbackRequestAsync()
    Tensor.CompleteAllPendingOperations()
    Tensor.Dispose()
    Tensor.ToString()
    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 TensorByte : Tensor, IDisposable

    Properties

    count

    The length of the tensor.

    Declaration
    public override int count { get; }
    Property Value
    Type Description
    int
    Overrides
    Tensor.count

    dataType

    The data type of the elements of the tensor.

    Declaration
    public override DataType dataType { get; }
    Property Value
    Type Description
    DataType
    Overrides
    Tensor.dataType

    Methods

    AllocZeros(TensorShape)

    Initializes and returns a tensor with the specified shape and filled with 0.

    Declaration
    public static TensorByte AllocZeros(TensorShape shape)
    Parameters
    Type Name Description
    TensorShape shape

    The shape of the tensor.

    Returns
    Type Description
    TensorByte

    The instantiated zero tensor.

    UploadToDevice(ITensorData)

    Uploads the tensor data to the destination data location on device.

    Declaration
    public override void UploadToDevice(ITensorData destination)
    Parameters
    Type Name Description
    ITensorData destination

    The data on device to upload the tensor data to.

    Overrides
    Tensor.UploadToDevice(ITensorData)

    Implements

    IDisposable

    Extension Methods

    TensorExtensions.PrintDataPart(Tensor, int, string)
    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)