1.
TypeError: cat() got an unexpected keyword argument 'axis'
提高pytorch的版本至1.2.0以上
2.
RuntimeError: Input type (torch.cuda.DoubleTensor) and weight type (torch.cuda.FloatTensor) should be the same
1)CUDA和CPU,输入数据x和模型中的权重值类型不一样,一般来说是因为模型的参数不在GPU中,而输入数据在GPU中,通过添加model.cuda()
将模型转移到GPU上以解决这个问题。
2) Input类型和模型的权重类型不一致,一个为Double一个为float,通过对输入数据Tensor(x)进行x.float()
将输入数据和模型权重类型一致,或者将模型权重的类型转化为Double也可以解决问题
https://oldpan.me/archives/pytorch-conmon-problem-in-training
https://discuss.pytorch.org/t/input-type-torch-cuda-doubletensor-and-weight-type-torch-cuda-floattensor-should-be-the-same/22704/
解决办法:
修改如下: