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

Duplicated function channel_shuffle() #2193

Closed
xkszltl opened this issue May 7, 2020 · 4 comments · Fixed by #2206
Closed

Duplicated function channel_shuffle() #2193

xkszltl opened this issue May 7, 2020 · 4 comments · Fixed by #2206

Comments

@xkszltl
Copy link
Contributor

xkszltl commented May 7, 2020

🐛 Bug

Get the following error when compiling today with pytorch master.
This should be a recent regression as I was able to do the same in Apr.

../torchvision/csrc/models/shufflenetv2.cpp:83:33: error: call of overloaded 'channel_shuffle(at::Tensor&, int)' is ambiguous
../torchvision/csrc/models/shufflenetv2.cpp:10:15: note: candidate: 'at::Tensor vision::models::channel_shuffle(at::Tensor, int64_t)'
/usr/local/include/ATen/Functions.h:8045:22: note: candidate: 'at::Tensor at::channel_shuffle(const at::Tensor&, int64_t)'

Environment

  • PyTorch / torchvision Version (e.g., 1.0 / 0.4.0): master/master
  • OS (e.g., Linux): Ubuntu 18.04
  • How you installed PyTorch / torchvision (conda, pip, source): source
  • Build command you used (if compiling from source): cmake+ninja+gcc-8
  • CUDA/cuDNN version: 10.2

Additional context

image

@zhangguanheng66
Copy link
Contributor

Could you add a code snippet to reproduce the error?

@xkszltl
Copy link
Contributor Author

xkszltl commented May 7, 2020

@zhangguanheng66 I think it's unnecessary.
This is simply a compile error saying you have 2 definitions of channel_shuffle():

  • One is in pytorch (ATen) probably from this commit during last week: pytorch/pytorch@df31ddb
  • The other is the one in the shufflenetv2.cpp.

Since there're using namespace at everywhere, even in .h, within this repo, it's not surprising to have ambiguity.

Suggest to be more specific by using ::vision::models::channel_shuffle, and if possible, check pytorch version and use theirs when available.

@fmassa
Copy link
Member

fmassa commented May 11, 2020

Thanks for opening this issue!

Can you send a PR fixing the implementation in torchvision to use the ::vision namespace?

@xkszltl
Copy link
Contributor Author

xkszltl commented May 12, 2020

@fmassa PR sent

facebook-github-bot pushed a commit that referenced this issue Jul 9, 2020
#2436)

Summary:
…). (#2206)

Fix #2193.

Pull Request resolved: #2436

Reviewed By: zhangguanheng66

Differential Revision: D22438556

Pulled By: fmassa

fbshipit-source-id: e5eb446d730551529b86bab6190261b07d94771a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants