add assertion to make sure positions and positions_flat are not empty (#3387)

This commit is contained in:
Hoanh Le authored and GitHub committed 2024-08-28 12:37:54 -07:00
1 parent 69ae4abbfd
commit 22dae34eeb
2 files changed
+6 -1

No files matched your search

+5
View File
@@ -211,10 +211,15 @@ class NerfactoField(Field):
# Make sure the tcnn gets inputs between 0 and 1.
selector = ((positions > 0.0) & (positions < 1.0)).all(dim=-1)
positions = positions * selector[..., None]
assert positions.numel() > 0, "positions is empty."
self._sample_locations = positions
if not self._sample_locations.requires_grad:
self._sample_locations.requires_grad = True
positions_flat = positions.view(-1, 3)
assert positions_flat.numel() > 0, "positions_flat is empty."
h = self.mlp_base(positions_flat).view(*ray_samples.frustums.shape, -1)
density_before_activation, base_mlp_out = torch.split(h, [1, self.geo_feat_dim], dim=-1)
self._density_before_activation = density_before_activation