Skip to content

fix: visibility_filter returns wrong type for indexing#1316

Open
Mr-Neutr0n wants to merge 1 commit into
graphdeco-inria:mainfrom
Mr-Neutr0n:fix/visibility-filter-mask-type
Open

fix: visibility_filter returns wrong type for indexing#1316
Mr-Neutr0n wants to merge 1 commit into
graphdeco-inria:mainfrom
Mr-Neutr0n:fix/visibility-filter-mask-type

Conversation

@Mr-Neutr0n
Copy link
Copy Markdown

Bug

visibility_filter in gaussian_renderer/__init__.py uses (radii > 0).nonzero(), which returns a 2D index tensor of shape (N, 1) instead of a boolean mask.

This 2D index tensor causes incorrect advanced indexing behavior when used downstream in train.py for operations like:

gaussians.max_radii2D[visibility_filter] = torch.max(gaussians.max_radii2D[visibility_filter], radii[visibility_filter])

and in add_densification_stats:

self.xyz_gradient_accum[update_filter] += torch.norm(viewspace_point_tensor.grad[update_filter,:2], dim=-1, keepdim=True)

These callsites expect a 1D boolean mask for proper element selection, but the 2D index tensor from .nonzero() triggers PyTorch advanced indexing, which can produce unexpected shapes and incorrect results.

Fix

Removed the .nonzero() call so visibility_filter returns radii > 0 directly -- a proper 1D boolean mask that works correctly with all downstream indexing operations.

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

Successfully merging this pull request may close these issues.

1 participant