block_serialise#

hypercoil.functional.sparse.block_serialise(f: Callable, *, n_blocks: int = 1, block_size: int | None = None, retnums: Sequence[int] = (0,), in_axes: Sequence[int] = (-1,), out_axes: Sequence[int] = (-1,), pad_value: Any = 0.0, carrier_fn: Callable | None = None, carry_init: Any | None = None, return_carry: bool = False, postprocess_fn: Callable | None = None) Callable[source]#

Serialise a function to be run over blocks of data, in order to reduce the memory footprint of each call.

Warning

Each specified input argument must be divisible by the number of blocks along the specified axis.

Warning

Any parameters that are not to be serialised must be passed as keyword arguments. If this is not possible using the original function, then you will have to write a wrapper function.