Lornatang / SRGAN-PyTorch

A simple and complete implementation of super-resolution paper.
Apache License 2.0
421 stars 104 forks source link

There is a bug on loss.py #22

Closed PhelaPoscam closed 3 years ago

PhelaPoscam commented 3 years ago

During the execution of GAN epochs:

Traceback (most recent call last): File "/content/drive/MyDrive/SRGAN-PyTorch-master/train.py", line 590, in main() File "/content/drive/MyDrive/SRGAN-PyTorch-master/train.py", line 154, in main main_worker(args.gpu, ngpus_per_node, args) File "/content/drive/MyDrive/SRGAN-PyTorch-master/train.py", line 392, in main_worker args=args) File "/content/drive/MyDrive/SRGAN-PyTorch-master/train.py", line 544, in train_gan content_loss = content_criterion(sr, hr.detach()) File "/usr/local/lib/python3.7/dist-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/content/drive/MyDrive/SRGAN-PyTorch-master/srgan_pytorch/loss.py", line 156, in forward source = (source - self.mean) / self.std RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

Any advice?

Lornatang commented 3 years ago

I found,I fixed it. I will qucikly update code.