pytorch数据类型报错解决方案:

pytorch报错:
RuntimeError: Expected object of type Variable[torch.LongTensor] but found type Variable[torch.cuda.ByteTensor] for argument #1 ‘argument1’

解决方法:

pytorch框架在存储labels时,采用LongTensor来存储,所以在一开始dataset返回label时,就要返回与LongTensor对应的数据类型,即numpy.int64

发布了55 篇原创文章 · 获赞 238 · 访问量 21万+

猜你喜欢

转载自blog.csdn.net/zkp_987/article/details/81132365