docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TensorFloat

    Represents data in a multidimensional array-like structure of floats.

    Inheritance
    object
    Tensor
    TensorFloat
    Implements
    IDisposable
    Inherited Members
    Tensor.shape
    Tensor.tensorOnDevice
    Tensor.allocator
    Tensor.AttachToDevice(ITensorData)
    Tensor.DetachFromDevice(bool)
    Tensor.MakeReadable()
    Tensor.MakeReadableAsync()
    Tensor.IsReadbackRequestDone()
    Tensor.ReadbackRequest(Action<bool>)
    Tensor.ReadbackRequestAsync()
    Tensor.CompleteAllPendingOperations()
    Tensor.ShallowCopy()
    Tensor.TakeOwnership()
    Tensor.Dispose()
    Tensor.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.Sentis
    Assembly: solution.dll
    Syntax
    public class TensorFloat : Tensor, IDisposable

    Constructors

    Name Description
    TensorFloat(float)

    Initializes and returns a scalar tensor with the value of srcData.

    TensorFloat(TensorShape, float[])

    Initializes and returns a tensor with the specified shape and a float[] array of srcData data.

    TensorFloat(TensorShape, float[], int)

    Initializes and returns a tensor with specified shape and a float[] array of srcData data. Sentis reads srcData from dataStartIndex.

    srcData.Length - dataStartIndex must be bigger than or equal to shape.length.

    TensorFloat(TensorShape, NativeArray<float>, int)

    Initializes and returns a tensor with specified shape and a native float array of srcData data. Sentis reads srcData from dataStartIndex.

    srcData.Length - dataStartIndex must be bigger than or equal to shape.length.

    Properties

    Name Description
    this[int]

    Returns the tensor element at offset d0.

    this[int, int]

    Returns the tensor element at offset (d1, d0), which is position d1 * stride0 + d0.

    this[int, int, int]

    Returns the tensor element at offset (d2, d1, d0), which is position d2 * stride1 + d1 * stride0 + d0.

    this[int, int, int, int]

    Returns the tensor element at offset (d3, d2, d1, d0), which is position d3 * stride2 + d2 * stride1 + d1 * stride0 + d0 in this tensor.

    this[int, int, int, int, int]

    Returns the tensor element at offset (d4, d3, d2, d1, d0), which is position d4 * stride3 + d3 * stride2 + d2 * stride1 + d1 * stride0 + d0.

    this[int, int, int, int, int, int]

    Returns the tensor element at offset (d5, d4, d3, d2, d1, d0), which is position d5 * stride4 + d4 * stride3 + d3 * stride2 + d2 * stride1 + d1 * stride0 + d0.

    this[int, int, int, int, int, int, int]

    Returns the tensor element at offset (d6, d5, d4, d3, d2, d1, d0), which is position d6 * stride5 + d5 * stride4 + d4 * stride3 + d3 * stride2 + d2 * stride1 + d1 * stride0 + d0.

    this[int, int, int, int, int, int, int, int]

    Returns the tensor element at offset (d7, d6, d5, d4, d3, d2, d1, d0), which is position d7 * stride6 + d6 * stride5 + d5 * stride4 + d4 * stride3 + d3 * stride2 + d2 * stride1 + d1 * stride0 + d0.

    dataType

    The data type of the elements of the tensor.

    Methods

    Name Description
    DeepCopy()

    Returns a deep copy of the current Tensor.

    ShallowReshape(TensorShape)

    Returns a shallow copy of the Tensor with a new shape. The copy shares data storage with the original tensor.

    newShape.length must be equal to this.shape.length.

    ToReadOnlyArray()

    Returns a copy of linear memory representation of the data in this tensor.

    the returned array is a deepcopy of the tensor, the caller of this methods is now responsible for it. If you modify the contents of the returned array, it will not modify the underlying tensor

    ToReadOnlySpan()

    Returns a ReadOnlySpan on the linear memory representation of the data in this tensor.

    UploadToDevice(ITensorData)

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

    Zeros(TensorShape)

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

    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)