只import torch时,使用b = torch.utils.data.SequentialSampler(a)就会报错:
AttributeError: module ‘torch.utils’ has no attribute ‘data’
解决办法:import torch.utils.data
就阔以啦~
原因是:我pytorch 版本是1.1版本的,1.7版本的pytorch直接导入torch包就不会出现这个问题。
AttributeError: module ‘torch.utils‘ has no attribute ‘data‘ 解决方法
最新推荐文章于 2024-05-06 17:07:09 发布