Deeploy.TilingExtension.TilingCodegen.padOffset
- Deeploy.TilingExtension.TilingCodegen.padOffset(offset: Tuple[int, ...], rank: int) Tuple[int, ...]
Pad an offset tuple to a target rank by prepending zeros.
Extends an offset tuple to a higher dimensionality by adding leading offset values of 0. This ensures offset tuples match the rank of their corresponding shapes.
- Parameters:
offset (Tuple[int, ...]) – The original offset tuple to pad.
rank (int) – The target rank (number of dimensions) for the padded offset.
- Returns:
The padded offset tuple with leading zeros.
- Return type:
Tuple[int, …]
- Raises:
AssertionError – If the target rank is smaller than the current offset’s rank.
Examples
>>> padOffset((2, 3), 4) (0, 0, 2, 3) >>> padOffset((5,), 3) (0, 0, 5)