Open BCWang93 opened 5 years ago
@BCWang93 How about change device
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
to just
device = torch.device('cpu')
Is there someone who knows how to edit code to use "cuda" to train the model instead of 'cpu'? Thanks a lot!
I have this error in run the code of style transfer: ' Traceback (most recent call last): File "main.py", line 86, in
main(opt)
File "main.py", line 81, in main
img=denorm(img.to(device)).clamp_(0,1)
File "/home/a/anaconda3/envs/bcw_env/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 163, in call
return F.normalize(tensor, self.mean, self.std, self.inplace)
File "/home/a/anaconda3/envs/bcwenv/lib/python3.6/site-packages/torchvision/transforms/functional.py", line 208, in normalize
tensor.sub(mean[:, None, None]).div_(std[:, None, None])
RuntimeError: expected type torch.cuda.FloatTensor but got torch.FloatTensor
' anyone can help me solve this?Thanks!