docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct TensorIterator

    Helper structure to iterate over tensor shape

    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Unity.Barracuda
    Assembly: solution.dll
    Syntax
    public struct TensorIterator

    Constructors

    TensorIterator(Tensor, int)

    Constructs Tensor shape iterator

    Declaration
    public TensorIterator(Tensor tensor, int index = 0)
    Parameters
    Type Name Description
    Tensor tensor

    Tensor

    int index

    starting index

    TensorIterator(TensorShape, int)

    Constructs Tensor shape iterator

    Declaration
    public TensorIterator(TensorShape shape, int index = 0)
    Parameters
    Type Name Description
    TensorShape shape

    shape

    int index

    starting index

    Fields

    d0

    dimension 0

    Declaration
    public int d0
    Field Value
    Type Description
    int

    d1

    dimension 1

    Declaration
    public int d1
    Field Value
    Type Description
    int

    d2

    dimension 2

    Declaration
    public int d2
    Field Value
    Type Description
    int

    d3

    dimension 3

    Declaration
    public int d3
    Field Value
    Type Description
    int

    d4

    dimension 4

    Declaration
    public int d4
    Field Value
    Type Description
    int

    d5

    dimension 5

    Declaration
    public int d5
    Field Value
    Type Description
    int

    d6

    dimension 6

    Declaration
    public int d6
    Field Value
    Type Description
    int

    d7

    dimension 7

    Declaration
    public int d7
    Field Value
    Type Description
    int

    index

    Index

    Declaration
    public int index
    Field Value
    Type Description
    int

    shape

    Tensor shape

    Declaration
    public readonly TensorShape shape
    Field Value
    Type Description
    TensorShape

    Properties

    this[int]

    Access specific axis value

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

    axis

    Property Value
    Type Description
    int

    Methods

    Advance(int)

    Advance iterator by step

    Declaration
    public void Advance(int step)
    Parameters
    Type Name Description
    int step

    step count

    IndexInReducedShape(TensorShape)

    Index in reduced shape

    Declaration
    public int IndexInReducedShape(TensorShape reducedShape)
    Parameters
    Type Name Description
    TensorShape reducedShape

    reduced shape

    Returns
    Type Description
    int

    index

    IndexWithReplacedAxis(int, int)

    Index with replaced axis value

    Declaration
    public int IndexWithReplacedAxis(int axis, int newDimensionValue)
    Parameters
    Type Name Description
    int axis

    axis to replace

    int newDimensionValue

    new value for specific axis

    Returns
    Type Description
    int

    index

    IsValid()

    Is iterator in valid state

    Declaration
    public bool IsValid()
    Returns
    Type Description
    bool

    true if iterator is still within shape

    Next()

    Next element in the Tensor shape space

    Declaration
    public void Next()
    In This Article
    Back to top
    Copyright © 2025 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)