pytorch报错 ConvTranspose1d object has no attribute padding_mode

‘ConvTranspose1d’ object has no attribute 'padding_mode’错误:https://github.com/NVIDIA/tacotron2/issues/182

解决方法:
Using torch 1.1.0.dev20190512 and waveglow_256channels.pt I was still getting this error. Following @apsears I managed to get it working. Here are the locations and changes required

即将一下 conv.py文件中的190行修改:
envs/nlp/lib/python3.6/site-packages/torch/nn/modules/conv.py line 190

 @weak_script_method
 def forward(self, input):
        if False: # self.padding_mode == 'circular'
            expanded_padding = ((self.padding[0] + 1) // 2, self.padding[0] // 2)
            return F.conv1d(F.pad(input, expanded_padding, mode='circular'),
                            self.weight, self.bias, self.stride,
                            _single(0), self.dilation, self.groups)
        return F.conv1d(input, self.weight, self.bias, self.stride,
                        self.padding, self.dilation, self.groups)

及641行

    @weak_script_method
    def forward(self, input, output_size=None):
        # type: (Tensor, Optional[List[int]]) -> Tensor
        #if self.padding_mode != 'zeros':
        #    raise ValueError('Only `zeros` padding mode is supported for ConvTranspose1d')

        output_padding = self._output_padding(input, output_size, self.stride, self.padding, self.kernel_size)
        return F.conv_transpose1d(
            input, self.weight, self.bias, self.stride, self.padding,
            output_padding, self.groups, self.dilation)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值