Return whether *x* is a JAX Array.
(x)
| 2440 | |
| 2441 | |
| 2442 | def _is_jax_array(x): |
| 2443 | """Return whether *x* is a JAX Array.""" |
| 2444 | try: |
| 2445 | # We're intentionally not attempting to import jax. If somebody |
| 2446 | # has created a jax array, jax should already be in sys.modules. |
| 2447 | tp = sys.modules.get("jax").Array |
| 2448 | except AttributeError: |
| 2449 | return False # Module not imported or a nonstandard module with no Array attr. |
| 2450 | return (isinstance(tp, type) # Just in case it's a very nonstandard module. |
| 2451 | and isinstance(x, tp)) |
| 2452 | |
| 2453 | |
| 2454 | def _is_mlx_array(x): |
no test coverage detected
searching dependent graphs…