reshape(x: array, /, shape: Tuple[int, ...], *, copy: bool | None = None) array

Reshapes an array without changing its data.

  • x (array) – input array to reshape.

  • shape (Tuple[int, ...]) – a new shape compatible with the original shape. One shape dimension is allowed to be -1. When a shape dimension is -1, the corresponding output array shape dimension must be inferred from the length of the array and the remaining dimensions.

  • copy (Optional[bool]) – whether or not to copy the input array. If True, the function must always copy. If False, the function must never copy. If None, the function must avoid copying, if possible, and may copy otherwise. Default: None.


out (array) – an output array having the same data type and elements as x.


ValueError – If copy=False and a copy would be necessary, a ValueError should be raised.