TensorLayout Structure

Represents the layout of a tensor in memory.

Definition

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

Remarks

Where a TensorShape specifies the dimensions of a tensor, the TensorLayout specifies how the elements of the tensor are laid out in memory.

Properties

Item Gets the stride along the specified axis.
Length Gets the number of dimensions in the layout.
Offset Gets the linear offset of the first element in the tensor.

Methods

CStyle Returns a contiguous C-style layout for the specified shape.
Equals(Object)Indicates whether this instance and a specified object are equal.
(Overrides ValueType.Equals(Object))
Equals(TensorLayout) Compares this layout to another layout.
EqualsExcept Compares this layout to another layout, ignoring the specified axes.
FortranStyle Returns a contiguous Fortran-style layout for the specified shape.
FromStrides Returns a tensor layout that uses the specified strides.
GetHashCodeReturns the hash code for this instance.
(Overrides ValueType.GetHashCode())
GetTypeGets the Type of the current instance.
(Inherited from Object)
IsContiguousFor Gets whether this layout is contiguous for a tensor with the specified shape.
LinearIndexToOffset Converts the linear index in the specified shape to an offset.
SwapAxes Returns a new layout that has the strides along the specified axes swapped.
ToIndices Converts a linear index to a set of indexes for each dimension according to the layout.
ToOffset(Int32) Converts a set of two integer indexes to a linear offset.
ToOffset(Int32[]) Converts a set of integer indexes to a linear offset.
ToOffset(ReadOnlySpan<Int32>) Converts a set of integer indexes to a linear offset.
ToOffset(Int32, Int32) Converts a set of two integer indexes to a linear offset.
ToOffset(Int32, Int32, Int32) Converts a set of three integer indexes to a linear offset.
ToOffset(Int32, Int32, Int32, Int32) Converts a set of four integer indexes to a linear offset.
ToStringReturns the fully qualified type name of this instance.
(Inherited from ValueType)

Operators

Equality(TensorLayout, TensorLayout) Compares two layouts for equality.
Inequality(TensorLayout, TensorLayout) Compares two layouts for inequality.

Fields

Scalar Gets the tensor layout for a scalar.

See Also