ttnn.fold
- ttnn.fold(input: ttnn.Tensor, stride_h: int, stride_w: int, collapse_output: bool | None) None
-
NHWC space-to-depth. Packs every stride_h * stride_w neighbourhood at position (h * stride_h, w * stride_w) into the channel dim at position (h, w). Shapes below use the padded H/W/C (any HW / channel padding is applied before folding).
Output shape: (N, Hp/stride_h, Wp/stride_w, Cp * stride_h * stride_w) where Hp, Wp, Cp are the padded input dims.
- Parameters:
-
input (ttnn.Tensor)Input tensor [N, H, W, C].
stride_h (int)Stride along H.
stride_w (int)Stride along W.
collapse_output (bool, optional)Default False. When True, returns (1, 1, N * Hp/stride_h * Wp/stride_w, Cp * stride_h * stride_w) instead.