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

Build error with Clang #29

Open
roastduck opened this issue Oct 12, 2020 · 0 comments
Open

Build error with Clang #29

roastduck opened this issue Oct 12, 2020 · 0 comments

Comments

@roastduck
Copy link

torch::Tensor scratch = torch::empty({H, layout.sum().item<int>(), 4}, layout.dtype());

Please have a look at this line. Implicit conversion from size_t to long is treated as an error in Clang.

  /tmp/pip-install-62i124mf/torch-blocksparse/csrc/utils.cpp:115:41: error: non-constant-expression cannot be narrowed from type 'size_
t' (aka 'unsigned long') to 'long' in initializer list [-Wc++11-narrowing]
    torch::Tensor scratch = torch::empty({H, layout.sum().item<int>(), 4}, layout.dtype());
                                          ^
  /tmp/pip-install-62i124mf/torch-blocksparse/csrc/utils.cpp:115:41: note: insert an explicit cast to silence this issue
    torch::Tensor scratch = torch::empty({H, layout.sum().item<int>(), 4}, layout.dtype());
                                          ^
                                          static_cast<long>( )

Using GCC avoids the error.

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

1 participant