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

GridEncoder can't handle empty positions #176

Open
ahmadki opened this issue Jul 27, 2023 · 0 comments
Open

GridEncoder can't handle empty positions #176

ahmadki opened this issue Jul 27, 2023 · 0 comments

Comments

@ahmadki
Copy link

ahmadki commented Jul 27, 2023

Calling GridEncoder with empty positions positions.shape=[0, 3] causes CUDA to enter an invalid state silently. Subsequent calls to CUDA kernels would fail with the following error:

RuntimeError: CUDA error: invalid configuration argument

More info: nerfstudio-project/nerfacc#207 (comment)

minimal code to repro:

import GridEncoder
import torch

input_dim=3
multires=6
num_levels=16
level_dim=2
base_resolution=16
log2_hashmap_size=19
desired_resolution=2048
align_corners=False
interpolation='linear'
bound = torch.ones(1, device="cuda")
positions = torch.randn(0, 3, device="cuda", dtype=torch.float32) # Notice the empty positions

encoder = GridEncoder(input_dim=input_dim, num_levels=num_levels, level_dim=level_dim, base_resolution=base_resolution, log2_hashmap_size=log2_hashmap_size, desired_resolution=desired_resolution, gridtype='hash', align_corners=align_corners, interpolation=interpolation)
dummy = torch.zeros((1000,), device="cuda", dtype=torch.int64) # Works
enc = encoder(positions, bound=bound, max_level=None)
dummy = torch.zeros((1000,), device="cuda", dtype=torch.int64) # Failes
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