expected Long (got Float)


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