RuntimeError: Function AddBackward0 returned an invalid gradient at index 1 - expected type torch.FloatTensor but got torch.cuda.FloatTensor

主要还是类型不一致
expected type torch.FloatTensor but got torch.cuda.FloatTensorexpected type torch.FloatTensor but got torch.cuda.FloatTensor
import torchsnooper 来方便调试
expected type torch.FloatTensor but got torch.cuda.FloatTensor
expected type torch.FloatTensor but got torch.cuda.FloatTensor

相关文章: