Skip to content

Avoid dividing by zero for identity axis-angle rotations - #571

Open
satiricalguru wants to merge 1 commit into
google-deepmind:mainfrom
satiricalguru:contrib/zero-axisangle-division
Open

satiricalguru wants to merge 1 commit into
google-deepmind:mainfrom
satiricalguru:contrib/zero-axisangle-division

Conversation

@satiricalguru

Copy link
Copy Markdown

axisangle_to_quat([0, 0, 0]) emits a NumPy warning when computing the identity quaternion. With np.errstate(invalid='raise', divide='raise'), it raises FloatingPointError. NumPy evaluates the division before np.where selects the identity branch.

Choose a safe denominator for the identity branch before dividing. The regression checks a single zero rotation and a mixed batch under strict NumPy error handling.

Verified with pytest -q dm_control/utils dm_control/composer/variation -W error::RuntimeWarning (135 passed).

Codex assisted with implementation, tests, and review.

Choose a safe denominator before NumPy evaluates the division. Check the identity quaternion for a single zero rotation and mixed batches under strict NumPy error handling.

Assisted-by: Codex <noreply@openai.com>
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