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

remove shortcut for zero samples #276

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions nerfacc/volrend.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ def rendering(

# Query sigma/alpha and color with gradients
if rgb_sigma_fn is not None:
if t_starts.shape[0] != 0:
rgbs, sigmas = rgb_sigma_fn(t_starts, t_ends, ray_indices)
else:
rgbs = torch.empty((0, 3), device=t_starts.device)
sigmas = torch.empty((0,), device=t_starts.device)
rgbs, sigmas = rgb_sigma_fn(t_starts, t_ends, ray_indices)
# if t_starts.shape[0] != 0:
# rgbs, sigmas = rgb_sigma_fn(t_starts, t_ends, ray_indices)
# else:
# rgbs = torch.empty((0, 3), device=t_starts.device)
# sigmas = torch.empty((0,), device=t_starts.device)
assert rgbs.shape[-1] == 3, "rgbs must have 3 channels, got {}".format(
rgbs.shape
)
Expand All @@ -115,11 +116,12 @@ def rendering(
"rgbs": rgbs,
}
elif rgb_alpha_fn is not None:
if t_starts.shape[0] != 0:
rgbs, alphas = rgb_alpha_fn(t_starts, t_ends, ray_indices)
else:
rgbs = torch.empty((0, 3), device=t_starts.device)
alphas = torch.empty((0,), device=t_starts.device)
rgbs, alphas = rgb_alpha_fn(t_starts, t_ends, ray_indices)
# if t_starts.shape[0] != 0:
# rgbs, alphas = rgb_alpha_fn(t_starts, t_ends, ray_indices)
# else:
# rgbs = torch.empty((0, 3), device=t_starts.device)
# alphas = torch.empty((0,), device=t_starts.device)
assert rgbs.shape[-1] == 3, "rgbs must have 3 channels, got {}".format(
rgbs.shape
)
Expand Down