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

时间:2021-04-01 13:16:21   收藏:0   阅读:0

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

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!