mlx.data.Buffer.squeeze

mlx.data.Buffer.squeeze#

Buffer.squeeze(self: mlx.data._c.Buffer, key: str, dim: Optional[Union[int, List[int]]] = None, output_key: str = '') mlx.data._c.Buffer#

Squeeze singleton dimensions.

If no dimension is provided squeeze all singleton dimensions.

Parameters:
  • key (str) – The sample key that contains the array we are operating on.

  • dim (int or list of ints, optional) – The dimensions to squeeze. If not provided squeeze all the singleton dimensions. (default: None)

  • output_key (str) – If it is not empty then write the result to this key instead of overwriting key. (default: ‘’)