mlx.data.Buffer.pad_to_size

mlx.data.Buffer.pad_to_size#

Buffer.pad_to_size(self: mlx.data._c.Buffer, key: str, dim: int, size: int, pad_value: float, output_key: str = '') mlx.data._c.Buffer#

Pad the end of an array such that its size is size.

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

  • dim (int) – Which dimension of the array to pad.

  • size (int) – The resulting size of the array at dimension dim.

  • pad_value (float) – What to pad with.

  • output_key (str) – The key to store the result in. If it is an empty string then overwrite the input. (default: ‘’)