Skip to content

Match eager NaN handling in compiled tree close assertions - #473

Open
sylvesterkaczmarek wants to merge 1 commit into
google-deepmind:mainfrom
sylvesterkaczmarek:fix/matching-nans-in-chexified-allclose
Open

sylvesterkaczmarek wants to merge 1 commit into
google-deepmind:mainfrom
sylvesterkaczmarek:fix/matching-nans-in-chexified-allclose

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Summary

Fixes #472.

Set equal_nan=True in the jittable close comparator, matching the existing eager NumPy assertion. Identical trees with NaNs in corresponding positions previously passed eagerly and failed when chexified under JIT.

Retain rejection of NaN-versus-finite values, mismatched NaN positions, finite differences outside tolerance and opposite infinities. The public signature, strict-mode limitations and tolerance values are unchanged.

Validation

Twelve cases and ten subtests compare eager and compiled outcomes, nested three-tree comparisons, custom diagnostics, empty inputs and a real jitted/vmapped masked-array calculation. No JAX execution or assertion dispatch is mocked.

  • New tests on unchanged main: 6 failed, 6 passed, 10 subtests passed.
  • Selected baseline: 335 passed, 48 skipped, 85 subtests passed.
  • asserts_test.py, asserts_chexify_test.py and the new module: 347 passed, 48 skipped, 95 subtests passed on both Python versions.
  • Python 3.11.16 / JAX 0.10.2 and Python 3.12.11 / JAX 0.11.2, CPU on macOS.
  • Pylint errors-only, Pyink on changed source lines/new tests, optimized-mode unittest execution, compilation and git diff --check passed.

The 48 existing skips remain. The full test.sh build/docs workflow, GPU and multi-device behavior were not tested. Matching-NaN acceptance follows the existing eager API; callers requiring finite values can continue to use the separate finiteness assertion.

Based on main at e82c00b9dc3481cb56824aea02e909b687e18354. No dependencies or workflows change.

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.

Matching NaNs fail close assertions only after JIT compilation

1 participant