Skip to content

rays reshape fix#958

Open
AlisherBlack wants to merge 2 commits into
nerfstudio-project:mainfrom
AlisherBlack:fix-reshape-rays
Open

rays reshape fix#958
AlisherBlack wants to merge 2 commits into
nerfstudio-project:mainfrom
AlisherBlack:fix-reshape-rays

Conversation

@AlisherBlack

@AlisherBlack AlisherBlack commented May 29, 2026

Copy link
Copy Markdown

The eval3d pixel rasterizer (rasterize_to_pixels_eval3d_extra) expects per-ray input flattened as (..., C, H*W, 6): it derives P = rays.shape[-2] and its assert_shape wants rank (num_batch_dims + 3). The public API above takes (and asserts) the image-shaped (..., C, H, W, 6), so flatten the H, W dims here. Row-major flattening matches the kernel's pixel index (row * W + col) and the image-shaped output, so no reshape is needed on the returned colors/alphas.

#967

@AlisherBlack AlisherBlack changed the title hotfix reshape hotfix reshape https://github.com/nerfstudio-project/gsplat/issues/967 Jun 2, 2026
@AlisherBlack AlisherBlack changed the title hotfix reshape https://github.com/nerfstudio-project/gsplat/issues/967 rays reshape fix #967 Jun 2, 2026
@AlisherBlack AlisherBlack changed the title rays reshape fix #967 rays reshape fix Jun 2, 2026
@AlisherBlack

Copy link
Copy Markdown
Author

@rodlima78, @vince-brisebois, could you plz review?

@gsplat-engage-bot gsplat-engage-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gsplat/rendering.py:1586 (outside this PR's diff)

The same rays shape mismatch exists in the autograd-path _rasterization() function: line 1398 asserts rays.shape == batch_dims + (C, H, W, 6), but rays is then passed unmodified to rasterize_to_pixels_eval3d at lines 1586 and 1631. rasterize_to_pixels_eval3d (in gsplat/cuda/_wrapper.py) just forwards to rasterize_to_pixels_eval3d_extra, which assert_shapes (batch_dims + (C, P, 6)) — so this path will fail the same assertion that PR 958 was created to fix. Consider mirroring the reshape (rays = rays.reshape(rays.shape[:-3] + (rays.shape[-3] * rays.shape[-2], 6))) before the rasterize call in _rasterization() as well, otherwise eval3d rendering through the autograd path remains broken.


Generated by a review agent (code review)

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