【报错以及nn.Con2d参数讲解】

问题:

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

思考:

是在前向传播中的卷积操作出了问题,而且是dilation设置出了问题。

解决:

首先需要了解卷积的参数设置。通过点击函数进去。

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"""

上面参数应该都很熟悉,然后我说一下dilation。
这里的dilation相当于是扩大率,具体了解的话可以搜索空洞卷积。
一般为一,就是和正常卷积一样,所以设置为0是不行的。当为其他数字时,是在需要卷积的对应区域每两个数字之间填充dilation-1个零。
比如说一个3*3卷积核,dilation rate=2,那么如图所示

在这里插入图片描述
当将dilation改为1之后即可运行。

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值