Tensor<T>.Reshape Method
Definition
Assembly: Numerics.NET.Tensors (in Numerics.NET.Tensors.dll) Version: 9.0.3
Overload List
Reshape(Int32[]) | Reshapes the tensor to have the specified dimensions. |
Reshape( | Reshapes the tensor to have the specified dimensions. |
Reshape(Int32[])
public Tensor<T> Reshape(
params int[] dimensions
)
Parameters
- dimensions Int32[]
Return Value
Tensor<T>A tensor that has the same values as this tensor but with dimensions specified by dimensions.
Exceptions
Argument | dimensions is null. |
Argument | When reshaping a tensor the number of elements must remain the same. |
Reshape(TensorShape, TensorElementOrder)
public abstract Tensor<T> Reshape(
TensorShape shape,
TensorElementOrder order = TensorElementOrder.CStyle
)
Parameters
- shape TensorShape
- The shape of the new tensor.
- order TensorElementOrder (Optional)
- Optional. Specifies the element order of the result. By default, elements are stored in C-style (row-major) order.
Return Value
Tensor<T>A tensor that has the same values as this tensor but with dimensions specified by shape.
Remarks
When reshaping a tensor the number of elements must remain the same.
One of the dimensions in shape may have the value -1. In this case, the dimension is inferred from the current shape and the other dimensions. Only one dimension can be left unspecified.
Whenever possible, elements are not copied and a view is returned.
Exceptions
Argument | More than one dimension in shape was left unspecified. |
Dimension | The number of elements in shape does not equal the number of elements in this shape. -or- One dimension was left unspecified in shape and the number of elements in the remaining dimensions does not divide the number of elements in this shape. |