# mlx.core.flatten — MLX 0.0.7 documentation

Skip to main content
`Ctrl`+`K`

# mlx.core.flatten

mlx.core.flatten(a: array, /, start_axis: int = 0, end_axis: int = - 1, *, stream: Union[ None , Stream , Device ] = None) → array

  Flatten an array.

  Parameters:

    - a (array) – Input array.

    - start_axis (int , optional) – The first dimension to flatten. Defaults to `0`.

    - end_axis (int , optional) – The last dimension to flatten. Defaults to `-1`.

    - stream (Stream , optional) – Stream or device. Defaults to `None` in which case the default stream of the default device is used.

  Returns:

    The flattened array.

  Return type:

    array