brentyi / jaxlie

Rigid transforms + Lie groups in JAX
MIT License
234 stars 15 forks source link

Preventing hidden NaNs in `exp` #11

Closed Theo-Cheynel closed 1 year ago

Theo-Cheynel commented 1 year ago

Why ?

In SO3.exp, there is a shim to prevent NaNs by using a jnp.where with a Taylor approximation for values under epsilon. However, this is still catched by the jax_debug_nans configuration, even when there are no NaNs present in the final outputs (the NaNs appear in the intermediate computations).

Contents of this PR

This can be solved easily by changing the arbitrary value from 0.0 to 1.0, thus removing the divisions by 0 and preventing the catch by the JAX NaN debugger.

codecov[bot] commented 1 year ago

Codecov Report

Patch and project coverage have no change.

Comparison is base (6903b24) 100.00% compared to head (c473fc0) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #11 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 13 13 Lines 556 556 ========================================= Hits 556 556 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `100.00% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brent+Yi#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://codecov.io/gh/brentyi/jaxlie/pull/11?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brent+Yi) | Coverage Δ | | |---|---|---| | [jaxlie/\_so3.py](https://codecov.io/gh/brentyi/jaxlie/pull/11?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brent+Yi#diff-amF4bGllL19zbzMucHk=) | `100.00% <ø> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brent+Yi). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Brent+Yi)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

brentyi commented 1 year ago

Thanks!