Skip to content

Commit 873c047

Browse files
committed
test(jit): accept static positional args matched by static_argnames on JAX>=0.12
1 parent c636012 commit 873c047

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎brainpy/math/object_transform/jit_test.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,14 @@ def call(self, fit=True):
149149
print()
150150
print(new_b1, )
151151
print(new_b2, )
152-
with self.assertRaises(jax.errors.TracerBoolConversionError):
152+
if jax.__version_info__ >= (0, 12):
153+
# JAX >= 0.12 maps a positional argument onto ``static_argnames``,
154+
# so ``fit=False`` passed positionally is static as well.
153155
new_b3 = program.call2(False)
156+
self.assertEqual(new_b3.shape, (2,))
157+
else:
158+
with self.assertRaises(jax.errors.TracerBoolConversionError):
159+
program.call2(False)
154160

155161
@pytest.mark.skip(reason="not implemented")
156162
def test_class_jit1_with_disable(self):

0 commit comments

Comments
 (0)