Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug when run the code #30

Closed
ForawardStar opened this issue Aug 4, 2019 · 2 comments
Closed

bug when run the code #30

ForawardStar opened this issue Aug 4, 2019 · 2 comments

Comments

@ForawardStar
Copy link

Hi,
When I run the code, I have a bug when a function in "networks_basic.py" is called, which is "in_tens.mean([2,3], keepdim=keepdim)". I don't know how to trackle this, so I take the liberty to ask for help. After search on the Internet, I guess the reason may be that the argument "dim" in the first position should be an integer instead of a list "[2,3]". The detailed error reporting information are as fllow.
Thanks

"Traceback (most recent call last):
File "compute_dists_pair.py", line 34, in
dist01 = model.forward(img0,img1).item()
File "PerceptualSimilarity-master/models/init.py", line 40, in forward
return self.model.forward(target, pred)
File "PerceptualSimilarity-master/models/dist_model.py", line 116, in forward
return self.net.forward(in0, in1, retPerLayer=retPerLayer)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/parallel/data_parallel.py", line 121, in forward
return self.module(*inputs[0], **kwargs[0])
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "PerceptualSimilarity-master/models/networks_basic.py", line 79, in forward
res = [spatial_average(self.lins[kk].model(diffs[kk]), keepdim=True) for kk in range(self.L)]
File "PerceptualSimilarity-master/models/networks_basic.py", line 79, in
res = [spatial_average(self.lins[kk].model(diffs[kk]), keepdim=True) for kk in range(self.L)]
File "PerceptualSimilarity-master/models/networks_basic.py", line 18, in spatial_average
return in_tens.mean([2,3],keepdim=keepdim)
TypeError: mean() received an invalid combination of arguments - got (list, keepdim=bool), but expected one of:

  • ()
  • (torch.dtype dtype)
  • (int dim, torch.dtype dtype)
    didn't match because some of the keywords were incorrect: keepdim
  • (int dim, bool keepdim, torch.dtype dtype)
  • (int dim, bool keepdim)
    didn't match because some of the arguments have invalid types: (list, keepdim=bool)

"

@richzhang
Copy link
Owner

I think if you update your pytorch version, it will accept a list of ints. I will look into better documenting the requirements.

@ForawardStar
Copy link
Author

thank you ,This bug is solved by using pytorch 1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants