[Error reporting and explanation of nn.Con2d parameters]

question:

RuntimeError: could not create a descriptor for a dilated convolution forward propagation primitive

think:

There is a problem with the convolution operation in the forward propagation, and there is a problem with the dilation setting.

solve:

First, you need to understand the parameter settings of convolution. Enter by clicking on the function.

Args:
        in_channels (int): Number of channels in the input image    输入通道数
        out_channels (int): Number of channels produced by the convolution 输出通道数
        kernel_size (int or tuple): Size of the convolving kernel  卷积核大小
        stride (int or tuple, optional): Stride of the convolution. Default: 1  步长
        padding (int or tuple, optional): Zero-padding added to both sides of
            the input. Default: 0   边界填充
        padding_mode (string, optional): ``'zeros'``, ``'reflect'``,
            ``'replicate'`` or ``'circular'``. Default: ``'zeros'`` 填充方式
        dilation (int or tuple, optional): Spacing between kernel elements. Default: 1 扩大率
        groups (int, optional): Number of blocked connections from input
            channels to output channels. Default: 1    将一组输入输出为多少组输出,一般为一
        bias (bool, optional): If ``True``, adds a learnable bias to the
            output. Default: ``True``  是否使用偏执
    """.format(**reproducibility_notes, **convolution_notes) + r"""

The above parameters should be familiar, and then I will talk about dilation.
The dilation here is equivalent to the expansion rate. If you know more about it, you can search for hole convolution.
Generally, it is one, which is the same as normal convolution, so setting it to 0 is not acceptable. When it is other numbers, dilation-1 zeros are filled between every two numbers in the corresponding area that needs to be convolved.
For example, a 3*3 convolution kernel, dilation rate=2, then as shown in the figure

insert image description here
It can be run after changing the dilation to 1.

Guess you like

Origin blog.csdn.net/aaatomaaa/article/details/128198137