Fix weird consts issue in from_plxpr
#2128
Merged
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.
Context:
When updating tests for #2078 , I was getting weird failures on this test:
catalyst/frontend/test/pytest/test_gradient.py
Line 757 in 5eec7c7
Basically what was happening was that the conversion of the target jaxpr was reordering the consts. So we need to use the consts for the new jaxpr, not the input jaxpr.
Description of the Change:
In all relevant translation steps, we pull the consts from the new jaxpr, not the original inputs.
Benefits:
Get correct results without errors.
Possible Drawbacks:
I didn't test all the other control flow primitives that might have the same issue, because I don't know how to trigger this is other cases.
Related GitHub Issues:
[sc-101609]