1.报错
RuntimeError: Input type (torch.cuda.DoubleTensor) and weight type (torch.cuda.FloatTensor) should be the same
2. 原因分析:
卷积的输入和网络权重类型不一样,实际输入的是DoubleTensor,要求FloatTensor
3. 解决方法:
https://discuss.pytorch.org/t/input-type-torch-cuda-doubletensor-and-weight-type-torch-cuda-floattensor-should-be-the-same/22704
到网络层将 input类型变更:
input=input.float()