klyn.math.NDArray.reshape
method
public reshape(notnull shape as ArrayList<Object>) as NDArray<T>
Description

Reshapes using a vector mixing integer widths, such as ULong metadata and Int literals. Only integer dimensions are accepted; no floating-point truncation or implicit signed/unsigned arithmetic is performed.

Parameters
ParameterDescription
shapePositive integer dimensions whose product equals the element count.
Returns

A reshaped copy with the same element type.

Throws
  • TypeError If a dimension is not an integer.
  • ValueException If dimensions are empty, invalid or incompatible.
  • NullException if shape is null at runtime; statically null arguments are rejected with TypeError.
Example
values = NDArray<Float>.ones([2, 3])
images = values.reshape([values.shape[0], 3, 1])
print(images.shape)