Pytorch | Pytorch框架中模型和数据的gpu和cpu模式:model.to(device), model.cuda(), model.cpu(), DataParallel
(gpu和cpu),在算梯度或者loss的时候,报错信息类似如下:RuntimeError:FunctionAddBackward0returnedaninvalidgradientatindex1-expectedtypetorch.cuda.FloatTensorbutgottorch.FloatTensorRuntim