Tensor.Stack<T> Method

Concatenates a sequence of tensors into a tensor of a higher dimension.

Definition

Namespace: Numerics.NET.Tensors
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.3
C#
public static Tensor<T> Stack<T>(
	Tensor<T>[] tensors,
	int axis = 0,
	Tensor<T>? result = null
)

Parameters

tensors  Tensor<T>[]
An array of tensors with elements of type T.
axis  Int32  (Optional)
Optional. The axis of the new dimension in the result.
result  Tensor<T>  (Optional)
Optional. The tensor that is to hold the result. May be null.

Type Parameters

T
The type of the elements of the tensors.

Return Value

Tensor<T>
The tensors in tensors stacked along dimension axis.

Exceptions

ArgumentNullException

tensors is null.

ArgumentException

One or more of the elements of tensors is null.

ArgumentOutOfRangeExceptionaxis is less than zero or greater than the tensor rank of the elements of tensors.
DimensionMismatchException

One or more elements of tensors has dimensions that are not compatible with the others.

-or-

result is not null and its dimensions do not match the dimensions of the stacked tensors.

See Also