fix: jax backend tolist for tracers in logging #2580
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR closes #1422
This failure is encountered during tracing time. JAX can not convert a tracer during
.tolist
(because it has no data to put in a list) which is why it fails with a different error. This PR checks if we're currently in tracing time and instead returns the tracer (or rather its abstract value for a little nicer representation).The new error looks as expected like this now:
The logging will print:
"Eval failed for data ShapedArray(float64[1]) pars: ShapedArray(float64[2])"
This is the most information available during tracing time (shape and dtype), there's not much more to give to the user.
Checklist Before Requesting Reviewer
Before Merging
For the PR Assignees: