背景:训练模型的时候报错Expected object of scalar type Long but got scalar type Float
解决:
方法一:
targets =torch.LongTensor(targets)
方法二:
targets = targets.to(self.device,dtype=torch.int64)
背景:训练模型的时候报错Expected object of scalar type Long but got scalar type Float
解决:
方法一:
targets =torch.LongTensor(targets)
方法二:
targets = targets.to(self.device,dtype=torch.int64)