# dask.array.reshape

### dask.array.reshape(x, shape, merge_chunks=True, limit=None)

Reshape array to new shape

* **Parameters:**
  **shape**
  : The new shape should be compatible with the original shape. If
    an integer, then the result will be a 1-D array of that length.
    One shape dimension can be -1. In this case, the value is
    inferred from the length of the array and remaining dimensions.

  **merge_chunks**
  : Whether to merge chunks using the logic in [`dask.array.rechunk()`](dask.array.rechunk.html.md#dask.array.rechunk)
    when communication is necessary given the input array chunking and
    the output shape. With `merge_chunks==False`, the input array will
    be rechunked to a chunksize of 1, which can create very many tasks.

  **limit: int (optional)**
  : The maximum block size to target in bytes. If no limit is provided,
    it defaults to using the `array.chunk-size` Dask config value.

#### SEE ALSO
[`dask.array.rechunk`](dask.array.rechunk.html.md#dask.array.rechunk)

[`numpy.reshape`](https://numpy.org/doc/stable/reference/generated/numpy.reshape.html#numpy.reshape)

### Notes

This is a parallelized version of the `np.reshape` function with the
following limitations:

1. It assumes that the array is stored in [row-major order](https://en.wikipedia.org/wiki/Row-_and_column-major_order)
2. It only allows for reshapings that collapse or merge dimensions like
   `(1, 2, 3, 4) -> (1, 6, 4)` or `(64,) -> (4, 4, 4)`

When communication is necessary this algorithm depends on the logic within
rechunk.  It endeavors to keep chunk sizes roughly the same when possible.

See [Reshaping](../array-chunks.html.md#array-chunks-reshaping) for a discussion the tradeoffs of
`merge_chunks`.

<!-- !! processed by numpydoc !! -->
