mlx.data.Buffer.pad_to_multiple

mlx.data.Buffer.pad_to_multiple#

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

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

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

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

  • pad_multiple (int) – The result should be a multiple of pad_multiple.

  • 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: ‘’)