gm.math.count_consecutive

gm.math.count_consecutive#

gemma.gm.math.count_consecutive(
values: kauldron.ktyping.array_type_meta.Array['L'],
) tuple[tuple[int | bool, int], ...][source]

Counts consecutive identical elements in a list.

Useful to debug masks with padding.

Parameters:

values – A list of elements.

Returns:

A tuple of tuples, where each inner tuple contains the element and its consecutive count.