Allow mjx.get_rgb/get_depth to accept batched render output#3216
Open
tkelestemur wants to merge 2 commits intogoogle-deepmind:mainfrom
Open
Allow mjx.get_rgb/get_depth to accept batched render output#3216tkelestemur wants to merge 2 commits intogoogle-deepmind:mainfrom
tkelestemur wants to merge 2 commits intogoogle-deepmind:mainfrom
Conversation
btaba
requested changes
Apr 9, 2026
| yield | ||
|
|
||
|
|
||
| def setUp(self): |
Collaborator
There was a problem hiding this comment.
can we keep this setup? we have other CI besides github CI, and want to make sure the tests have minimal changes. LGTM otherwise
Author
There was a problem hiding this comment.
Restored the existing Warp/CUDA-gated setup and kept the new batched-shape assertions as the only functional test change. Re-ran the MJX suite on this final shape (376 passed, 39 skipped).
Restore the existing Warp/CUDA-gated render_util test setup so the review change stays minimal while preserving the new batched shape coverage. Made-with: Cursor
btaba
approved these changes
Apr 9, 2026
Author
|
Thanks @btaba Good to go! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mjx.get_rgb()andmjx.get_depth()accept packed buffers with leading batch dimensions, so callers can passmjx.render()outputs directly for both single-world and batched rendering.(..., H, W, 3)for RGB and(..., H, W, 1)for depth.render_utiltests to cover direct batched inputs and remove the unnecessary Warp/CUDA dependency from these JAX-side unpacking tests.Why
mjx.render()always returns packed outputs with a leading world axis, including whennworld == 1, but the public unpacking helpers previously only handled a single packed buffer. This change makes the helper API match the render API and removes the need for downstream callers to manually squeeze orvmapbefore unpacking.Testing
python -m pytest mjx/mujoco/mjx/_src/render_util_test.py -qpython -m pytest -n auto -v -k 'not IntegrationTest' --pyargs mujoco.mjxpython -m pytest -v --pyargs mujococtest -C Release --output-on-failure