Deeploy.TilingExtension.TilingCodegen.padStride
- Deeploy.TilingExtension.TilingCodegen.padStride(stride: Tuple[int, ...], rank: int, paddingStride: int) Tuple[int, ...]
Pad a stride tuple to a target rank by prepending a specified stride value.
Extends a stride tuple to a higher dimensionality by adding leading stride values. This is useful for maintaining consistent stride calculations across different tensor ranks.
- Parameters:
stride (Tuple[int, ...]) – The original stride tuple to pad.
rank (int) – The target rank (number of dimensions) for the padded stride.
paddingStride (int) – The stride value to use for padding (prepended dimensions).
- Returns:
The padded stride tuple with leading padding stride values.
- Return type:
Tuple[int, …]
- Raises:
AssertionError – If the target rank is smaller than the current stride’s rank.
Examples
>>> padStride((4, 1), 4, 16) (16, 16, 4, 1) >>> padStride((1,), 3, 8) (8, 8, 1)