module = nn.SpatialSubSampling(nInputPlane, kW, kH, [dW], [dH])
Applies a 2D sub-sampling over an input image composed of several input planes. The input
tensor in
forward(input)
is expected to be a 3D tensor (width x height x nInputPlane
). The number of output
planes will be the same as nInputPlane
.
The parameters are the following:
nInputPlane
forward()
.
kW
kH
dW
1
.
dH
1
.
Note that depending of the size of your kernel, several (of the last) columns or rows of the input image might be lost. It is up to the user to add proper padding in images.
If the input image is a 3D tensor width x height x nInputPlane
, the output image size
will be owidth x oheight x nInputPlane
where
owidth = (width - kW) / dW + 1 oheight = (height - kH) / dH + 1 .
The parameters of the sub-sampling can be found in self.weight
(Tensor of
size nInputPlane
) and self.bias
(Tensor of size nInputPlane
). The
corresponding gradients can be found in self.gradWeight
and
self.gradBias
.
The output value of the layer can be precisely described as:
output[i][j][k] = bias[k] + weight[k] sum_{s=1}^kW sum_{t=1}^kH input[dW*(i-1)+s)][dH*(j-1)+t][k]