关于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

上一篇:AttributeError: module ‘socket‘ has no attribute ‘AF_INET‘


下一篇:深入组件一、组件注册,Props,非 Prop 的 Attribute