gm.data.Pad

gm.data.Pad#

class gemma.gm.data.Pad(*, key: typing.Annotated[typing.Any, <kauldron.kontext.annotate._KeyToken object at 0x7001c239ecf0>] | typing.Sequence[typing.Annotated[typing.Any, <kauldron.kontext.annotate._KeyToken object at 0x7001c239ecf0>]] | dict[typing.Annotated[typing.Any, <kauldron.kontext.annotate._KeyToken object at 0x7001c239ecf0>], typing.Annotated[typing.Any, <kauldron.kontext.annotate._KeyToken object at 0x7001c239ecf0>]], max_length: int, truncate: bool = False)[source]

Bases: kauldron.data.transforms.base.ElementWiseTransform

Add zeros to the end of the sequence to reach the max length.

max_length

The max length of the sequence.

Type:

int

truncate

Whether to truncate the sequence to the max length. If False, sequences longer than the max_length will raise an error.

Type:

bool

max_length: int
truncate: bool = False
map_element(
element: kauldron.ktyping.array_type_meta.Array['length'],
) kauldron.ktyping.array_type_meta.Array['max_length'][source]