使用pytorch构建ResNet18网络模型时出现以下错误

TypeError: conv2d() received an invalid combination of arguments - got (ReLU, Parameter, Parameter, tuple, tuple, tuple, int), but expected one of:
 * (Tensor input, Tensor weight, Tensor bias, tuple of ints stride, tuple of ints padding, tuple of ints dilation, int groups)
      didn't match because some of the arguments have invalid types: (ReLU, Parameter, Parameter, tuple, tuple, tuple, int)
 * (Tensor input, Tensor weight, Tensor bias, tuple of ints stride, str padding, tuple of ints dilation, int groups)
      didn't match because some of the arguments have invalid types: (ReLU, Parameter, Parameter, tuple, tuple, tuple, int)

具体情况如下

解决后

具体原因可以参考

https://discuss.pytorch.org/t/whats-the-difference-between-nn-relu-vs-f-relu/27599

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐