Skip to content

Commit

Permalink
Fix training when background disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyu committed Nov 13, 2021
1 parent 71d4730 commit d7a784e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion svox2/svox2.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,14 @@ def __init__(
dtype=torch.float32, device=device
)
)
else:
self.background_data = nn.Parameter(
torch.empty(
0, 0, 0,
dtype=torch.float32, device=device
),
requires_grad=False
)

self.register_buffer("links", init_links.view(reso))
self.links: torch.Tensor
Expand Down Expand Up @@ -853,7 +861,7 @@ def volume_render(
self.density_data,
self.sh_data,
basis_data,
self.background_data,
self.background_data if self.use_background else None,
self._to_cpp(replace_basis_data=basis_data),
rays._to_cpp(),
self.opt._to_cpp(randomize=randomize),
Expand Down

0 comments on commit d7a784e

Please sign in to comment.