Struct TensorIterator
Helper structure to iterate over tensor shape
Namespace: Unity.Barracuda
Syntax
public struct TensorIterator
Constructors
TensorIterator(Tensor, Int32)
Constructs Tensor shape iterator
Declaration
public TensorIterator(Tensor tensor, int index = 0)
Parameters
Type | Name | Description |
---|---|---|
Tensor | tensor | Tensor |
Int32 | index | starting index |
TensorIterator(TensorShape, Int32)
Constructs Tensor shape iterator
Declaration
public TensorIterator(TensorShape shape, int index = 0)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | shape | shape |
Int32 | index | starting index |
Fields
d0
dimension 0
Declaration
public int d0
Field Value
Type | Description |
---|---|
Int32 |
d1
dimension 1
Declaration
public int d1
Field Value
Type | Description |
---|---|
Int32 |
d2
dimension 2
Declaration
public int d2
Field Value
Type | Description |
---|---|
Int32 |
d3
dimension 3
Declaration
public int d3
Field Value
Type | Description |
---|---|
Int32 |
d4
dimension 4
Declaration
public int d4
Field Value
Type | Description |
---|---|
Int32 |
d5
dimension 5
Declaration
public int d5
Field Value
Type | Description |
---|---|
Int32 |
d6
dimension 6
Declaration
public int d6
Field Value
Type | Description |
---|---|
Int32 |
d7
dimension 7
Declaration
public int d7
Field Value
Type | Description |
---|---|
Int32 |
index
Index
Declaration
public int index
Field Value
Type | Description |
---|---|
Int32 |
shape
Tensor shape
Declaration
public readonly TensorShape shape
Field Value
Type | Description |
---|---|
TensorShape |
Properties
Item[Int32]
Access specific axis value
Declaration
public int this[int axis] { get; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | axis | axis |
Property Value
Type | Description |
---|---|
Int32 |
Methods
Advance(Int32)
Advance iterator by step
Declaration
public void Advance(int step)
Parameters
Type | Name | Description |
---|---|---|
Int32 | 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 |
---|---|
Int32 | index |
IndexWithReplacedAxis(Int32, Int32)
Index with replaced axis
value
Declaration
public int IndexWithReplacedAxis(int axis, int newDimensionValue)
Parameters
Type | Name | Description |
---|---|---|
Int32 | axis | axis to replace |
Int32 | newDimensionValue | new value for specific axis |
Returns
Type | Description |
---|---|
Int32 | index |
IsValid()
Is iterator in valid state
Declaration
public bool IsValid()
Returns
Type | Description |
---|---|
Boolean |
|
Next()
Next element in the Tensor shape space
Declaration
public void Next()