SlidingWindowTranspose#

class SlidingWindowTranspose(output_size, kernel_size, padding=0, stride=1, dilation=1, **kwargs)[source]#

Opposite opration of SlidingWindow, sum over the sliding windows on the corresponding input location. Given an input of the size \((N, C, IH, IW, window_h, window_w)\) and output_size, the output shape would be \((N, C, output\_size_{h}, output\_size_{w})\) and the arguments must satisfy

\[\text{IH} = \lfloor \frac{\text{output_size}_{h} + 2 * \text{padding}_{h} - \text{dilation}_{h} * (\text{kernel_size}_{h} - 1) - 1}{\text{stride}_{h}} + 1 \rfloor\]
\[\text{IW} = \lfloor \frac{\text{output_size}_{w} + 2 * \text{padding}_{w} - \text{dilation}_{w} * (\text{kernel_size}_{w} - 1) - 1}{\text{stride}_{w}} + 1 \rfloor\]

For each output location, we have:

\[\text{out}_{n, c, oh, ow} = \sum_{n,c,oh,ow=location(n, c, ih, iw, wh, ww)}\text{src}_{n, c, ih, iw, wh, ww}\]
\[\begin{split}\text{location}(n, c, ih, iw, wh, ww) &= (n, c, oh+wh, ow+ww) \\ \text{where } & oh=-pad_h+ih \times stride_h + (wh-1) \times (dilation_h-1) \\ & ow=-pad_w+iw \times stride_w + (ww-1) \times (dilation_w-1)\end{split}\]
Parameters: