LocalConv2d¶
- class LocalConv2d(in_channels, out_channels, input_height, input_width, kernel_size, stride=1, padding=0, dilation=1, groups=1, conv_mode='cross_correlation', **kwargs)[source]¶
Applies a spatial convolution with untied kernels over an groupped channeled input 4D tensor. It is also known as the locally connected layer.
- Parameters
in_channels (
int
) – number of input channels.out_channels (
int
) – number of output channels.input_height (
int
) – the height of the input images.input_width (
int
) – the width of the input images.kernel_size (
Union
[int
,Tuple
[int
,int
]]) – size of weight on spatial dimensions. If kernel_size is anint
, the actual kernel size would be(kernel_size, kernel_size)
.stride (
Union
[int
,Tuple
[int
,int
]]) – stride of the 2D convolution operation. Default: 1padding (
Union
[int
,Tuple
[int
,int
]]) – size of the paddings added to the input on both sides of its spatial dimensions. Only zero-padding is supported. Default: 0dilation (
Union
[int
,Tuple
[int
,int
]]) – dilation of the 2D convolution operation. Default: 1groups (
int
) – number of groups into which the input and output channels are divided, so as to perform a “grouped convolution”. Whengroups
is not 1,in_channels
andout_channels
must be divisible bygroups
. Default: 1
Note
weight
usually has shape(out_height, out_width, in_channels, height, width, in_channels)
, if groups is not 1, shape will be(groups, out_height, out_width, in_channels // groups, height, width, out_channels // groups)
bias
usually has shape(1, out_channels, *1)