Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup complex values and tol in tests for jax.scipy.linalg.sparse.cg #2717

Merged
merged 3 commits into from
Apr 15, 2020

Commits on Apr 15, 2020

  1. Fixup complex values and tol in tests for jax.scipy.linalg.sparse.cg

    The tests for CG were failing on TPUs:
    
    - `test_cg_pytree` is fixed by requiring slightly less precision than the
      unit-test default.
    - `test_cg_against_scipy` is fixed for complex values in two independent ways:
      1. We don't set both `tol=0` and `atol=0`, which made the termination
         behavior of CG (convergence or NaN) dependent on exactly how XLA handles
         arithmetic with denormals.
      2. We make use of *real valued* inner products inside `cg`, even for complex
         values. It turns that all these inner products are mathematically
         guaranteed to yield a real number anyways, so we can save some flops and
         avoid ill-defined comparisons of complex-values (see
         numpy/numpy#15981) by ignoring the complex part
         of the result from `jnp.vdot`. (Real numbers also happen to have the
         desired rounding behavior for denormals on TPUs, so this on its own would
         also fix these failures.)
    shoyer committed Apr 15, 2020
    Configuration menu
    Copy the full SHA
    1d144b7 View commit details
    Browse the repository at this point in the history
  2. comment fixup

    shoyer committed Apr 15, 2020
    Configuration menu
    Copy the full SHA
    e173f8b View commit details
    Browse the repository at this point in the history
  3. fix my comment

    shoyer committed Apr 15, 2020
    Configuration menu
    Copy the full SHA
    4559f5e View commit details
    Browse the repository at this point in the history