expected Long (got Float)

不同类型的Tensor之间不能互转
torch.LongTensor(labels)
解决方法:先转化成numpy
labels=torch.LongTensor(labels.numpy())

posted @ 2021-08-12 20:32  吴莫愁258  阅读(434)  评论(0编辑  收藏  举报