Unverified Commit d8de4301 authored by Ruilong Li(李瑞龙)'s avatar Ruilong Li(李瑞龙) Committed by GitHub
Browse files

remove shortcut for zero samples (#276)

parent 3eef9208
...@@ -88,11 +88,12 @@ def rendering( ...@@ -88,11 +88,12 @@ def rendering(
# Query sigma/alpha and color with gradients # Query sigma/alpha and color with gradients
if rgb_sigma_fn is not None: if rgb_sigma_fn is not None:
if t_starts.shape[0] != 0:
rgbs, sigmas = rgb_sigma_fn(t_starts, t_ends, ray_indices) rgbs, sigmas = rgb_sigma_fn(t_starts, t_ends, ray_indices)
else: # if t_starts.shape[0] != 0:
rgbs = torch.empty((0, 3), device=t_starts.device) # rgbs, sigmas = rgb_sigma_fn(t_starts, t_ends, ray_indices)
sigmas = torch.empty((0,), device=t_starts.device) # 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( assert rgbs.shape[-1] == 3, "rgbs must have 3 channels, got {}".format(
rgbs.shape rgbs.shape
) )
...@@ -115,11 +116,12 @@ def rendering( ...@@ -115,11 +116,12 @@ def rendering(
"rgbs": rgbs, "rgbs": rgbs,
} }
elif rgb_alpha_fn is not None: elif rgb_alpha_fn is not None:
if t_starts.shape[0] != 0:
rgbs, alphas = rgb_alpha_fn(t_starts, t_ends, ray_indices) rgbs, alphas = rgb_alpha_fn(t_starts, t_ends, ray_indices)
else: # if t_starts.shape[0] != 0:
rgbs = torch.empty((0, 3), device=t_starts.device) # rgbs, alphas = rgb_alpha_fn(t_starts, t_ends, ray_indices)
alphas = torch.empty((0,), device=t_starts.device) # 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( assert rgbs.shape[-1] == 3, "rgbs must have 3 channels, got {}".format(
rgbs.shape rgbs.shape
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment