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

Fix GridSampling3D fails when called with a cuda data tensor without batch key #795

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fifarraj
Copy link

Currently when GridSampling3D is called with a cuda data tensor which does not have a "batch" key, it fails with the below exception. This PR fixes it.

Exception has occurred: RuntimeError       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
The following operation failed in the TorchScript interpreter.
Traceback of TorchScript (most recent call last):
  File "/home/firas/miniconda3/envs/legged_gym_crash_torch_121/lib/python3.8/site-packages/torch_cluster/grid.py", line 32, in grid_cluster
        cluster = grid_cluster(pos, size)
    """
    return torch.ops.torch_cluster.grid(pos, size, start, end)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
RuntimeError: size.device().is_cuda() INTERNAL ASSERT FAILED at "csrc/cuda/grid_cuda.cu":31, please report a bug to PyTorch. size must be CUDA tensor


  File "torch_points3d/core/data_transform/grid_transform.py", line 119, in _process
    cluster = grid_cluster(coords, torch.tensor([1, 1, 1]))
  File "torch_points3d/core/data_transform/grid_transform.py", line 135, in __call__
    data = self._process(data)

To test:

import torch
from torch_points3d.core.data_transform import GridSampling3D
from torch_geometric.data import Batch

data = torch.tensor([[0,0,0]], device='cuda')
data = Batch(pos=data)
pcd_to_grid = GridSampling3D(torch.tensor([0.2], device='cuda'))
pcd_to_grid(data)

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

Successfully merging this pull request may close these issues.

None yet

1 participant