Skip to content

Comments

Fix put_data crash when nefc=0 for dense models#1174

Merged
erikfrey merged 1 commit intogoogle-deepmind:mainfrom
kevinzakka:fix-efc-j-reshape-nefc-zero
Feb 22, 2026
Merged

Fix put_data crash when nefc=0 for dense models#1174
erikfrey merged 1 commit intogoogle-deepmind:mainfrom
kevinzakka:fix-efc-j-reshape-nefc-zero

Conversation

@kevinzakka
Copy link
Collaborator

@kevinzakka kevinzakka commented Feb 22, 2026

Tendons with frictionloss > 0 cause MuJoCo to pre-allocate efc_J with size nv even when nefc=0. This makes put_data crash with ValueError: cannot reshape array of size N into shape (0, N) on the dense code path. This fix short-circuits to np.zeros((0, nv)) when nefc == 0 before the sparse/dense branch.

Tendons with frictionloss cause MuJoCo to pre-allocate efc_J with
size nv even when nefc=0, causing reshape((0, nv)) to fail with
ValueError. Short-circuit to np.zeros((0, nv)) before the
sparse/dense branch.
@kevinzakka kevinzakka force-pushed the fix-efc-j-reshape-nefc-zero branch from de96ec3 to fd3c1d3 Compare February 22, 2026 21:16
Copy link
Collaborator

@erikfrey erikfrey left a comment

Choose a reason for hiding this comment

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

Nice, thanks Kevin.

@erikfrey erikfrey merged commit 42a7c56 into google-deepmind:main Feb 22, 2026
10 checks passed
@kevinzakka kevinzakka deleted the fix-efc-j-reshape-nefc-zero branch February 22, 2026 21:48
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.

2 participants