docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct TensorNDIterator

    Represents a struct used to iterate over a TensorShape.

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Unity.Sentis
    Assembly: Unity.Sentis.dll
    Syntax
    public struct TensorNDIterator

    Constructors

    TensorNDIterator(TensorNDIterator)

    Returns a copy of another TensorNDIterator.

    Declaration
    public TensorNDIterator(TensorNDIterator other)
    Parameters
    Type Name Description
    TensorNDIterator other

    The iterator to copy.

    TensorNDIterator(TensorShape)

    Initializes and returns an instance of TensorNDIterator with a given shape.

    Declaration
    public TensorNDIterator(TensorShape shape)
    Parameters
    Type Name Description
    TensorShape shape

    The shape of the iterator.

    TensorNDIterator(TensorShape, int)

    Initializes and returns an instance of TensorNDIterator with a given shape, and uses a given index in the flattened 1D version of the shape.

    Declaration
    public TensorNDIterator(TensorShape shape, int index)
    Parameters
    Type Name Description
    TensorShape shape

    The shape of the iterator.

    int index

    The index in the flattened shape.

    Fields

    index

    The 1D flattened index.

    Declaration
    public int index
    Field Value
    Type Description
    int

    Properties

    this[int]

    Gets or sets the iterator at a given axis.

    Declaration
    public int this[int axis] { get; set; }
    Parameters
    Type Name Description
    int axis

    The axis at which to get or set the index.

    Property Value
    Type Description
    int

    shape

    The shape that is iterated over.

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

    Methods

    Broadcast(TensorShape)

    Creates a new iterator by broadcasting this iterator on a given shape following the broadcast rule.

    Declaration
    public TensorNDIterator Broadcast(TensorShape shapeToBroadcast)
    Parameters
    Type Name Description
    TensorShape shapeToBroadcast

    The shape to broadcast with.

    Returns
    Type Description
    TensorNDIterator

    The broadcast iterator.

    CopyNDIndex(TensorNDIterator)

    Copies the dimension indices from another iterator. If the shapes of the iterators are not the same the final flattened index may be different.

    Declaration
    public void CopyNDIndex(TensorNDIterator other)
    Parameters
    Type Name Description
    TensorNDIterator other

    The iterator to copy.

    HasNext()

    Whether the iterator is yet to reach the end of the shape.

    Declaration
    public bool HasNext()
    Returns
    Type Description
    bool

    Whether the iterator can increment.

    HasNext(int)

    Whether the iterator is yet to reach the end of the shape on a given axis.

    Declaration
    public bool HasNext(int axis)
    Parameters
    Type Name Description
    int axis

    The axis along which to check.

    Returns
    Type Description
    bool

    Whether the iterator can increment along the axis.

    MoveNext()

    Increments the flattened index by one.

    Declaration
    public void MoveNext()

    MoveNextAxis(int)

    Increments the index at a given axis by one.

    Declaration
    public void MoveNextAxis(int axis)
    Parameters
    Type Name Description
    int axis

    The axis along which to increment.

    RemoveDim(int)

    Creates a new iterator by skipping an axis of this iterator.

    Declaration
    public TensorNDIterator RemoveDim(int axis)
    Parameters
    Type Name Description
    int axis

    The axis to skip.

    Returns
    Type Description
    TensorNDIterator

    The created iterator.

    Reset()

    Resets the iterator to the start of the shape.

    Declaration
    public void Reset()

    ToString()

    Returns a string that represents the TensorNDIterator.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    The string representation of the iterator.

    Overrides
    ValueType.ToString()

    Transpose()

    Creates a new iterator by transposing this iterator reversing the axes.

    Declaration
    public TensorNDIterator Transpose()
    Returns
    Type Description
    TensorNDIterator

    The transposed iterator.

    Transpose(int[])

    Creates a new iterator by transposing this iterator using the given permutations.

    Declaration
    public TensorNDIterator Transpose(int[] permutations)
    Parameters
    Type Name Description
    int[] permutations

    The permutation array.

    Returns
    Type Description
    TensorNDIterator

    The transposed iterator.

    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)