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 Data can be in a non readable type (GPU/NPU)
      • Call CompleteAllPendingOperations to finish computing the tensor's data
      • Call ReadbackAndClone or ReadBackAndCloneAsync to allow reading the tensor's data

    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.IsReadbackRequestDone()
    Tensor.ReadbackRequest()
    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.

    Implements

    IDisposable
    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)