错误类型:
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor)
定义残差块时定义在model的外面,在使用gpu进行训练的时候,残差块的参数是torch.FloatTensor类型,
虽然使用了model.cuda(),但是只对model里面的参数在gpu部分,所以把残差块对应的操作都在model的__init__(),
重新定义,即可解决问题
错误类型:
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.FloatTensor)
定义残差块时定义在model的外面,在使用gpu进行训练的时候,残差块的参数是torch.FloatTensor类型,
虽然使用了model.cuda(),但是只对model里面的参数在gpu部分,所以把残差块对应的操作都在model的__init__(),
重新定义,即可解决问题