Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Accept ValueError for JAX backend
tolist
fallback (#1746)
* In JAX v0.2.27 the error raised for trying to pass a sequence as a list includes a ValueError >>> import jax >>> import jax.numpy as jnp >>> jax.__version__ '0.2.27' >>> jnp.asarray([[1, 2], 3, [4]]) TypeError: int() argument must be a string, a bytes-like object or a number, not 'list' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/.../site-packages/jax/_src/numpy/lax_numpy.py", line 3648, in asarray return array(a, dtype=dtype, copy=False, order=order) File "/.../site-packages/jax/_src/numpy/lax_numpy.py", line 3606, in array out = np.array(object, dtype=dtype, ndmin=ndmin, copy=False) ValueError: setting an array element with a sequence. To handle this, also accept ValueError as a valid exception when falling back to list.
- Loading branch information