14 Commits

Author SHA1 Message Date
Ruturaj Vaidya
8c48c0f62a
35 several uts (#282)
* Don't perform size 0 slices into scipy rotations.

This is disallowed by scipy after https://github.com/scipy/scipy/pull/21776.

(cherry picked from commit 834e71bbe1e4e23de8f658e7380c385be7c5099a)

* test: change random matrix generation for Rotation

(cherry picked from commit 4d433d063e2274d2998913d615aa168889a91b9a)

* Skip lax_scipy_special_functions_test as it will be fixed in the next JAX version

---------

Co-authored-by: Peter Hawkins <phawkins@google.com>
Co-authored-by: Jake VanderPlas <jakevdp@google.com>
2025-03-14 09:41:59 -05:00
Filippo Luca Ferretti
2ff26ff3e0 Add scalar_first argument to jax.scipy.spatial.transform.Rotation.as_quat 2024-09-16 21:57:55 +02:00
Pavel Sountsov
5ba26953be Add canonical arg to Rotation.as_quat() and switch .inv() to use the quaternion conjugate.
This matches scipy behavior as of 1.11.

I also went through the tests and enabled a bunch of disabled tests which appear to pass now(?).

PiperOrigin-RevId: 655719643
2024-07-24 15:29:19 -07:00
Jake VanderPlas
3833c46d10 jnp.vectorize: respect numpy_rank_promotion config 2024-07-08 09:03:03 -07:00
Jake VanderPlas
f090074d86 Avoid 'from jax import config' imports
In some environments this appears to import the config module rather than
the config object.
2024-04-11 13:23:27 -07:00
Jake VanderPlas
1870eee062 Test: make scipy version parsing compatible with pre-releases 2024-01-12 14:35:28 -08:00
Sergei Lebedev
1079304259 MAINT Do not import the config object in JAX internals
The longer term goal here is to move away from having the config object as
part of the public API and migrate towards module-level functions instead.

Note that we can preserve the dynamic attribute lookup behavior of the
config object via a module-level `__getattr__`
2023-10-18 10:55:13 +01:00
Peter Hawkins
1885c4933c Add a new internal test utility test_device_matches() and use it instead of equality tests on device_under_test().
This change prepares for allowing more flexible tag matching. For example, we may want to write "gpu" in a test and have it match both "cuda" and "rocm" devices, which we cannot do under the current API but can easily do under this design.

Replace uses of device_under_test() in a context that performs an equality test with a call to test_device_matches().
Replace uses of if_device_under_test() with test_device_matches() and delete if_device_under_test().

PiperOrigin-RevId: 568923117
2023-09-27 12:10:43 -07:00
Andrey Portnoy
34ea2b2e8a Increase comparison tolerance in SciPy spatial RotationMean subtest
Previous value leads to failures on A100 runners in
github.com/NVIDIA/JAX-Toolbox CI:
https://github.com/NVIDIA/JAX-Toolbox/actions/runs/6144692887/job/16670611913#step:8:1014

The suspected reason is the use of TF32 math for matmuls: decorating the
function with @jax.default_matmul_precision("float32") allows the test to pass.
We thought it's better to loosen the tolerance but preserve the original
execution mode.

The fully qualified test case is
tests/scipy_spatial_test.py::LaxBackedScipySpatialTransformTests::testRotationMean0
2023-09-12 16:12:14 -04:00
Chris Flesher
5a2936d19d Fix problematic rotation tests 2023-06-20 05:27:20 -05:00
Jake VanderPlas
6bfcc46405 Disable some problematic rotation tests 2023-06-20 00:59:02 -07:00
Skye Wanderman-Milne
d8571cfb6b Increase precision in LaxBackedScipySpatialTransformTests.testRotationApply
Otherwise the test fails due to small numerical differences.

PiperOrigin-RevId: 538921774
2023-06-08 16:30:58 -07:00
jax authors
8d27f20637 Merge pull request #16246 from chrisflesher:scipy-rotation-v3
PiperOrigin-RevId: 538788621
2023-06-08 08:10:58 -07:00
Chris Flesher
5be17ed90c Added scipy.spatial.transform Rotation and Slerp classes 2023-06-08 07:51:32 -05:00