pytorch/examples

Input type and weight type should be the same

Open

#599 opened on Aug 1, 2019

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Python (9,429 forks)batch import
good first issuetriaged

Repository metrics

Stars
 (21,634 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

For the super resolve run, I get this error

$ python super_resolve.py --input_image dataset/BSDS300/images/test/16077.jpg --model model_epoch_30.pth --output_filename out.png
Namespace(cuda=False, input_image='dataset/BSDS300/images/test/16077.jpg', model='model_epoch_30.pth', output_filename='out.png')
Traceback (most recent call last):
  File "super_resolve.py", line 29, in <module>
    out = model(input)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 491, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/mahmood/cactus/pt/pytorch/examples/super_resolution/model.py", line 20, in forward
    x = self.relu(self.conv1(x))
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 491, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/conv.py", line 339, in forward
    self.padding, self.dilation, self.groups)
RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same

Any idea?

P.S: Although readme file says model_epoch_500.pth, but with --nEpochs 30, I see model_epoch_30.pth

Contributor guide