adam_core.utils.chunking module

adam_core.utils.chunking.pad_to_fixed_size(array, target_shape, pad_value=0)[source]

Pad an array to a fixed shape with a specified pad value.

Parameters:
  • array (array-like) – Array to pad

  • target_shape (tuple) – Desired output shape

  • pad_value (int or float, optional) – Value to use for padding, by default 0

Returns:

padded_array – Padded array with desired shape

Return type:

array-like

adam_core.utils.chunking.process_in_chunks(array, chunk_size)[source]

Yield chunks of the array with a fixed size, padding the last chunk if necessary.

Parameters:
  • array (array-like) – Array to process in chunks

  • chunk_size (int) – Size of each chunk

Yields:

chunk (array-like) – Array chunk of fixed size (padded if necessary)