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

metrics.py invokes torch.max with "an invalid combination of arguments " #116

Closed
gsgbills opened this issue Jan 28, 2018 · 3 comments
Closed

Comments

@gsgbills
Copy link


TypeError Traceback (most recent call last)
in ()
----> 1 accuracy(*learn.TTA())

~/fastai/courses/dl1/fastai/metrics.py in accuracy(preds, targs)
3
4 def accuracy(preds, targs):
----> 5 preds = torch.max(preds, dim=1)[1]
6 return (preds==targs).float().mean()
7

TypeError: torch.max received an invalid combination of arguments - got (numpy.ndarray, dim=int), but expected one of:

  • (torch.FloatTensor source)
  • (torch.FloatTensor source, torch.FloatTensor other)
    didn't match because some of the keywords were incorrect: dim
  • (torch.FloatTensor source, int dim)
  • (torch.FloatTensor source, int dim, bool keepdim)
@gsgbills
Copy link
Author

This maybe the same issue as #115 .

@gsgbills
Copy link
Author

arguments should be cast, e.g., torchLongTensor(targs)

@jph00
Copy link
Member

jph00 commented Jan 28, 2018

Let's move the discussion to #115 . We'll need more info about where you're calling the function from to fix this properly, BTW.

@jph00 jph00 closed this as completed Jan 28, 2018
borisdayma pushed a commit to borisdayma/fastai that referenced this issue Aug 18, 2020
fix bbox coordinates convention
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