Flattens the input tensor into a 2D tensor. If input tensor has shape (1, 2, 3,...n) then the output will have shape (1 * 2 * 3 * ... (axis-1), axis * (axis+1) * ... n).
Args
self(@Tensor<T>) - The input tensor.
axis(usize) - Indicate up to which input dimensions (exclusive) should be flattened.
Panics
Panics if axis is not in the range of the input tensor's dimensions.
Returns
A new Tensor<T> instance containing the flattened version of the input tensor.