TensorShape Structure

Represents the shape (dimensions) of a tensor.

Definition

Namespace: Numerics.NET.Tensors
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.0
C#
public readonly struct TensorShape : IEquatable<TensorShape>
Inheritance
Object  →  ValueType  →  TensorShape
Implements
IEquatable<TensorShape>

Constructors

TensorShape Constructs a new tensor shape with the specified dimensions.

Properties

Dimensions Gets a span containing the dimensions of the shape.
ElementCount Gets the total number of elements in the shape.
Item[Index] Gets the size of the specified dimension.
Item[Int32] Gets the size of the specified dimension.
Rank Gets the number of dimensions.

Methods

Append Adds a dimension of the specified size to the end of the current shape.
AsSpan Returns the dimensions of the tensor shape as a readonly span of integers.
Broadcast(TensorShape[]) Returns the shape of the result of an elementwise operation when applied, with broadcasting, to operands with the specified shapes.
Broadcast(TensorShape, TensorShape) Returns the shape of the result of an elementwise operation when applied, with broadcasting, to operands with the specified shapes.
Broadcast(TensorShape, TensorShape, TensorShape) Returns the shape of the result of an elementwise operation when applied, with broadcasting, to operands with the specified shapes.
CanBroadcastFrom(TensorShape) Gets whether this shape can be broadcast into from another shape.
CanBroadcastFrom(TensorShape, TensorShape) Gets whether this shape can be broadcast into another shape.
CanBroadcastTo Returns whether a shape is entirely contained within another shape.
ColumnVector Represents the shape of a column vector of the specified length.
CreateFromArray Returns the shape of an array.
Equals(Object)Determines whether the specified object is equal to the current object.
(Overrides ValueType.Equals(Object))
Equals(TensorShape) Compares this shape to another shape.
GetHashCodeServes as the default hash function.
(Overrides ValueType.GetHashCode())
GetTypeGets the Type of the current instance.
(Inherited from Object)
Insert(Index, Int32) Inserts a dimension of the specified size at the specified position in the current shape.
Insert(Int32, Int32) Inserts a dimension of the specified size at the specified position in the current shape.
RemoveAt(Axes) Removes the specified dimensions from the current shape.
RemoveAt(Index) Returns a new tensor shape with the specified axis removed.
RemoveAt(Int32) Returns a new tensor shape with the specified axis removed.
RowVector Represents the shape of a row vector of the specified length.
SwapAxes(Index, Index) Returns a new tensor shape that has the dimensions along the specified axes swapped.
SwapAxes(Int32, Int32) Returns a new tensor shape that has the dimensions along the specified axes swapped.
ToStringReturns the fully qualified type name of this instance.
(Overrides ValueType.ToString())
TryBroadcast Attempts to compute the shape of the result of an elementwise operation when applied, with broadcasting, to operands with the specified shapes.
Vector Represents the shape of a vector of the specified length.
WithDimension(Axes, Int32) Replaces the specified dimensions with the specified size.
WithDimension(Index, Int32) Returns a tensor shape that has one dimension changed from this shape.
WithDimension(Int32, Int32) Returns a tensor shape that has one dimension changed from this shape.

Operators

Equality(TensorShape, TensorShape) Compares two shapes for equality.
Implicit(Int32 to TensorShape) Implicitly converts a single integer to a TensorShape.
Implicit(Int32[] to TensorShape) Implicitly converts an integer array to a TensorShape.
Implicit(ValueTuple<Int32, Int32> to TensorShape) Implicitly converts an integer tuple to a TensorShape.
Implicit(ValueTuple<Int32, Int32, Int32> to TensorShape) Implicitly converts an integer tuple to a TensorShape.
Implicit(ValueTuple<Int32, Int32, Int32, Int32> to TensorShape) Implicitly converts an integer tuple to a TensorShape.
Implicit(ValueTuple<Int32, Int32, Int32, Int32, Int32> to TensorShape) Implicitly converts an integer tuple to a TensorShape.
Implicit(ValueTuple<Int32, Int32, Int32, Int32, Int32, Int32> to TensorShape) Implicitly converts an integer tuple to a TensorShape.
Implicit(ValueTuple<Int32, Int32, Int32, Int32, Int32, Int32, Int32> to TensorShape) Implicitly converts an integer tuple to a TensorShape.
Inequality(TensorShape, TensorShape) Compares two shapes for inequality.

Fields

Scalar Represents the shape of a scalar, a 0-dimensional tensor.

See Also