Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Fix bug in test_ndarray.py when using the latest version of JAX #708

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion brainpy/_src/math/ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _check_tracer(self):
self_value = self.value
if hasattr(self_value, '_trace') and hasattr(self_value._trace.main, 'jaxpr_stack'):
if len(self_value._trace.main.jaxpr_stack) == 0:
raise RuntimeError('This Array is modified during the transformation. '
raise jax.errors.UnexpectedTracerError('This Array is modified during the transformation. '
'BrainPy only supports transformations for Variable. '
'Please declare it as a Variable.') from jax.core.escaped_tracer_error(self_value, None)
return self_value
Expand Down
2 changes: 1 addition & 1 deletion brainpy/_src/math/tests/test_ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _f(self, b):

def test_tracing(self):
print(self.f(1.))
with self.assertRaises(RuntimeError):
with self.assertRaises(jax.errors.UnexpectedTracerError):
print(self.f(bm.ones(10)))


Expand Down
Loading