Struct SymbolicTensorShape
Represents the shape of an input tensor, or the predicted shape of a tensor before Sentis executes.
Inherited Members
Namespace: Unity.Sentis
Assembly: Unity.Sentis.dll
Syntax
[Serializable]
public struct SymbolicTensorShape
Constructors
SymbolicTensorShape(int)
Initializes and returns an instance of SymbolicTensorShape
with a rank of 1: (d0).
For example (9).
Declaration
public SymbolicTensorShape(int d0)
Parameters
Type | Name | Description |
---|---|---|
int | d0 | The |
SymbolicTensorShape(int, int)
Initializes and returns an instance of SymbolicTensorShape
with a rank of 2: (d1, d0).
For example (8, 9).
Declaration
public SymbolicTensorShape(int d1, int d0)
Parameters
Type | Name | Description |
---|---|---|
int | d1 | The |
int | d0 | The |
SymbolicTensorShape(int, int, int)
Initializes and returns an instance of SymbolicTensorShape
with a rank of 3: (d2, d1, d0).
For example (7, 8, 9).
Declaration
public SymbolicTensorShape(int d2, int d1, int d0)
Parameters
Type | Name | Description |
---|---|---|
int | d2 | The |
int | d1 | The |
int | d0 | The |
SymbolicTensorShape(int, int, int, int)
Initializes and returns an instance of SymbolicTensorShape
with a rank of 4: (d3, d2, d1, d0).
For example (6, 7, 8, 9).
Declaration
public SymbolicTensorShape(int d3, int d2, int d1, int d0)
Parameters
Type | Name | Description |
---|---|---|
int | d3 | The |
int | d2 | The |
int | d1 | The |
int | d0 | The |
SymbolicTensorShape(SymbolicTensorDim)
Initializes and returns an instance of SymbolicTensorShape
with a rank of 1: (d0).
For example (9).
Declaration
public SymbolicTensorShape(SymbolicTensorDim d0)
Parameters
Type | Name | Description |
---|---|---|
SymbolicTensorDim | d0 | The |
SymbolicTensorShape(SymbolicTensorDim, SymbolicTensorDim)
Initializes and returns an instance of SymbolicTensorShape
with a rank of 2: (d1, d0).
For example (8, 9).
Declaration
public SymbolicTensorShape(SymbolicTensorDim d1, SymbolicTensorDim d0)
Parameters
Type | Name | Description |
---|---|---|
SymbolicTensorDim | d1 | The |
SymbolicTensorDim | d0 | The |
SymbolicTensorShape(SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim)
Initializes and returns an instance of SymbolicTensorShape
with a rank of 3: (d2, d1, d0).
For example (7, 8, 9).
Declaration
public SymbolicTensorShape(SymbolicTensorDim d2, SymbolicTensorDim d1, SymbolicTensorDim d0)
Parameters
Type | Name | Description |
---|---|---|
SymbolicTensorDim | d2 | The |
SymbolicTensorDim | d1 | The |
SymbolicTensorDim | d0 | The |
SymbolicTensorShape(SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim)
Initializes and returns an instance of SymbolicTensorShape
with a rank of 4: (d3, d2, d1, d0).
For example (6, 7, 8, 9).
Declaration
public SymbolicTensorShape(SymbolicTensorDim d3, SymbolicTensorDim d2, SymbolicTensorDim d1, SymbolicTensorDim d0)
Parameters
Type | Name | Description |
---|---|---|
SymbolicTensorDim | d3 | The |
SymbolicTensorDim | d2 | The |
SymbolicTensorDim | d1 | The |
SymbolicTensorDim | d0 | The |
SymbolicTensorShape(SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim)
Initializes and returns an instance of SymbolicTensorShape
with a rank of 5: (d4, d3, d2, d1, d0).
For example (5, 6, 7, 8, 9).
Declaration
public SymbolicTensorShape(SymbolicTensorDim d4, SymbolicTensorDim d3, SymbolicTensorDim d2, SymbolicTensorDim d1, SymbolicTensorDim d0)
Parameters
Type | Name | Description |
---|---|---|
SymbolicTensorDim | d4 | The |
SymbolicTensorDim | d3 | The |
SymbolicTensorDim | d2 | The |
SymbolicTensorDim | d1 | The |
SymbolicTensorDim | d0 | The |
SymbolicTensorShape(SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim)
Initializes and returns an instance of SymbolicTensorShape
with a rank of 6: (d5, d4, d3, d2, d1, d0).
For example (4, 5, 6, 7, 8, 9).
Declaration
public SymbolicTensorShape(SymbolicTensorDim d5, SymbolicTensorDim d4, SymbolicTensorDim d3, SymbolicTensorDim d2, SymbolicTensorDim d1, SymbolicTensorDim d0)
Parameters
Type | Name | Description |
---|---|---|
SymbolicTensorDim | d5 | The |
SymbolicTensorDim | d4 | The |
SymbolicTensorDim | d3 | The |
SymbolicTensorDim | d2 | The |
SymbolicTensorDim | d1 | The |
SymbolicTensorDim | d0 | The |
SymbolicTensorShape(SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim)
Initializes and returns an instance of SymbolicTensorShape
with a rank of 7: (d6, d5, d4, d3, d2, d1, d0).
For example (3, 4, 5, 6, 7, 8, 9).
Declaration
public SymbolicTensorShape(SymbolicTensorDim d6, SymbolicTensorDim d5, SymbolicTensorDim d4, SymbolicTensorDim d3, SymbolicTensorDim d2, SymbolicTensorDim d1, SymbolicTensorDim d0)
Parameters
Type | Name | Description |
---|---|---|
SymbolicTensorDim | d6 | The |
SymbolicTensorDim | d5 | The |
SymbolicTensorDim | d4 | The |
SymbolicTensorDim | d3 | The |
SymbolicTensorDim | d2 | The |
SymbolicTensorDim | d1 | The |
SymbolicTensorDim | d0 | The |
SymbolicTensorShape(SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim, SymbolicTensorDim)
Initializes and returns an instance of SymbolicTensorShape
with a rank of 8: (d7, d6, d5, d4, d3, d2, d1, d0).
For example (2, 3, 4, 5, 6, 7, 8, 9).
Declaration
public SymbolicTensorShape(SymbolicTensorDim d7, SymbolicTensorDim d6, SymbolicTensorDim d5, SymbolicTensorDim d4, SymbolicTensorDim d3, SymbolicTensorDim d2, SymbolicTensorDim d1, SymbolicTensorDim d0)
Parameters
Type | Name | Description |
---|---|---|
SymbolicTensorDim | d7 | The |
SymbolicTensorDim | d6 | The |
SymbolicTensorDim | d5 | The |
SymbolicTensorDim | d4 | The |
SymbolicTensorDim | d3 | The |
SymbolicTensorDim | d2 | The |
SymbolicTensorDim | d1 | The |
SymbolicTensorDim | d0 | The |
SymbolicTensorShape(SymbolicTensorShape)
Returns a copy of another SymbolicTensorShape
.
Declaration
public SymbolicTensorShape(SymbolicTensorShape other)
Parameters
Type | Name | Description |
---|---|---|
SymbolicTensorShape | other | The |
SymbolicTensorShape(TensorShape)
Initializes and returns an instance of SymbolicTensorShape
with a given TensorShape
, and no unknown or dynamic dimensions. For example: SymbolicTensorShape(new TensorShape(3, 4, 5, 6))
returns a symbolic tensor shape of (3, 4, 5, 6).
Declaration
public SymbolicTensorShape(TensorShape other)
Parameters
Type | Name | Description |
---|---|---|
TensorShape | other | The |
Properties
this[int]
Gets or sets the tensor shape at a given axis. Ex: shape (3, 4, 5, 6) index 0, 1, 2, 3 -4,-3,-2,-1 shape (7, 3, 2) index 0, 1, 2 -3,-2,-1
Declaration
public SymbolicTensorDim this[int axis] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
int | axis |
Property Value
Type | Description |
---|---|
SymbolicTensorDim |
rank
The rank of a SymbolicTensorShape
, For example, a tensor of shape (5) has a rank of 1. A tensor of shape (7, 3, 5) has a rank of 3.
Declaration
public int rank { get; }
Property Value
Type | Description |
---|---|
int |
Methods
Equals(object)
Determines whether the specified object is equal to the current SymbolicTensorShape
.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare. |
Returns
Type | Description |
---|---|
bool | Whether the object is equal to the current |
Overrides
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | The calculated hash code. |
Overrides
IsFullyKnown()
Checks if the SymbolicTensorShape
is fully defined and can be converted to a TensorShape
.
Declaration
public bool IsFullyKnown()
Returns
Type | Description |
---|---|
bool | Whether the |
ToString()
Returns a string that represents the SymbolicTensorShape
.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | The string representation of the |
Overrides
ToTensorShape()
Converts the SymbolicTensorShape
to a TensorShape
. You should call IsFullyKnown
before you call this method.
Declaration
public TensorShape ToTensorShape()
Returns
Type | Description |
---|---|
TensorShape | The converted |
UnknownOfRank(int)
Creates and returns a SymbolicTensorShape
with given rank and all dimensions unknown.
Declaration
public static SymbolicTensorShape UnknownOfRank(int rank)
Parameters
Type | Name | Description |
---|---|---|
int | rank | The rank of the |
Returns
Type | Description |
---|---|
SymbolicTensorShape | The created |
Operators
operator ==(SymbolicTensorShape, SymbolicTensorShape)
Compares two SymbolicTensorShape
objects. Returns true
if the two objects have the same rank, and all their dimensions are equal.
Declaration
public static bool operator ==(SymbolicTensorShape a, SymbolicTensorShape b)
Parameters
Type | Name | Description |
---|---|---|
SymbolicTensorShape | a | The first |
SymbolicTensorShape | b | The second |
Returns
Type | Description |
---|---|
bool | Whether the two |
operator !=(SymbolicTensorShape, SymbolicTensorShape)
Compares two SymbolicTensorShape
objects. Returns true
if the two shapes have a different or unknown rank, or at least one of their dimensions are not equal.
Declaration
public static bool operator !=(SymbolicTensorShape a, SymbolicTensorShape b)
Parameters
Type | Name | Description |
---|---|---|
SymbolicTensorShape | a | The first |
SymbolicTensorShape | b | The second |
Returns
Type | Description |
---|---|
bool | Whether the two |