关于python的pytorch运行中的问题汇总

1.pytorch报错:module 'torch.nn' has no attribute 'init

修改/home/expstu1/anaconda3/lib/python3.6/site-packages/torch/nn/__init__.py

文件在最后一行加from .init import *

2.AttributeError: module 'torch.nn.init' has no attribute 'xavier_uniform_'

去掉'xavier_uniform_'的_

3.AttributeError: 'torch.cuda.LongTensor' object has no attribute 'shape'

将shape改成size

posted @ 2021-03-31 20:29  不爱吃芹菜的猫  阅读(653)  评论(0)    收藏  举报