SlidingWindowTranspose

class SlidingWindowTranspose(output_size, kernel_size, padding=0, stride=1, dilation=1, **kwargs)[源代码]

SlidingWindow 的相反操作,对相应输入位置的滑动窗口求和。给定一个大小 \((N, C, IH, IW, window_h, window_w)\) 的input 和 output_size,output shape 应该是 \((N, C, output\_size_{h}, output\_size_{w})\) 并且参数必须满足

\[\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\]

对于每个output 位置,有:

\[\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}\]
参数