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

RuntimeError: expected scalar type Long but found Float #41

Closed
fabiopoiesi opened this issue Dec 18, 2019 · 2 comments
Closed

RuntimeError: expected scalar type Long but found Float #41

fabiopoiesi opened this issue Dec 18, 2019 · 2 comments
Labels

Comments

@fabiopoiesi
Copy link

Hi,

I have this issue.

This is the code:

batch = torch.tensor(np.zeros(len(target)), dtype=torch.float)
target_tensor = torch.tensor(target, dtype=torch.float)
indices = fps(target_tensor, batch, ratio=0.5, random_start=False)

and this is the error:
RuntimeError: expected scalar type Long but found Float (data_ptr at /hardmnt/bumblebee1/data/fabio/research/DenseFusion/venv2/lib/python3.5/site-packages/torch/include/ATen/core/TensorMethods.h:5747)
frame #0: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x33 (0x7f2282e1a813 in /home/poiesi/data/research/DenseFusion/venv2/lib/python3.5/site-packages/torch/lib/libc10.so)
frame #1: long* at::Tensor::data_ptr() const + 0x16c (0x7f22106fdb8c in /home/poiesi/data/research/DenseFusion/venv2/lib/python3.5/site-packages/torch_cluster/fps_cpu.cpython-35m-x86_64-linux-gnu.so)
frame #2: fps(at::Tensor, at::Tensor, float, bool) + 0x76 (0x7f22106fa116 in /home/poiesi/data/research/DenseFusion/venv2/lib/python3.5/site-packages/torch_cluster/fps_cpu.cpython-35m-x86_64-linux-gnu.so)
frame #3: + 0x22df4 (0x7f221070fdf4 in /home/poiesi/data/research/DenseFusion/venv2/lib/python3.5/site-packages/torch_cluster/fps_cpu.cpython-35m-x86_64-linux-gnu.so)
frame #4: + 0x2302e (0x7f221071002e in /home/poiesi/data/research/DenseFusion/venv2/lib/python3.5/site-packages/torch_cluster/fps_cpu.cpython-35m-x86_64-linux-gnu.so)
frame #5: + 0x1f656 (0x7f221070c656 in /home/poiesi/data/research/DenseFusion/venv2/lib/python3.5/site-packages/torch_cluster/fps_cpu.cpython-35m-x86_64-linux-gnu.so)
frame #6: PyCFunction_Call + 0x77 (0x4e1307 in /home/poiesi/data/research/DenseFusion/venv2/bin/python)
...

Any guess?
Thanks

@rusty1s
Copy link
Owner

rusty1s commented Dec 18, 2019

batch needs to be a long tensor.

@github-actions
Copy link

This issue had no activity for 6 months. It will be closed in 2 weeks unless there is some new activity. Is this issue already resolved?

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

No branches or pull requests

2 participants