Skip to content

Commit b485d59

Browse files
junjiang-labcopybara-github
authored andcommitted
Fix JAX bridge incompatibility with NumPy < 2.0
PiperOrigin-RevId: 823564334
1 parent f74158b commit b485d59

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • ai_edge_torch/odml_torch/jax_bridge

ai_edge_torch/odml_torch/jax_bridge/_wrap.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,15 @@ def lower_wrapper(*args):
7979
nonlocal jax_lower_static_kwargs
8080

8181
jaxfn_args = []
82-
jaxfn_kwargs = jax_lower_static_kwargs.copy()
82+
jaxfn_kwargs = {
83+
k: (
84+
jax.numpy.array(v)
85+
if isinstance(v, (int, float)) and not isinstance(v, bool)
86+
else v
87+
)
88+
for k, v in jax_lower_static_kwargs.items()
89+
}
90+
8391
for name, arg in zip(jax_lower_argnames, args):
8492
if name is None:
8593
jaxfn_args.append(arg)

0 commit comments

Comments
 (0)