Calling ``while_p.bind`` results in an error
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Reproduce the failure using the issue's Python example with catalyst.jax_primitives.while_p and jax.make_jaxpr, then inspect the tracing path around DynshapePrimitive.bind and DynamicJaxprTrace.make_eqn. Done means the shown while_p.bind call no longer raises the unexpected out_tracers TypeError.
Written by the indexing model from the issue text.
Description
Hi Catalyst team and congratulations to your new release!
When migrating to the latest version, I came across an issue that reproduced by the following code:
from jax import make_jaxpr
from catalyst.jax_primitives import AbstractQreg, while_p
def body(val):
return val
body_jaxpr = make_jaxpr(body)(AbstractQreg())
def cond(val):
return True
cond_jaxpr = make_jaxpr(body)(AbstractQreg())
def main(qreg):
while_res = while_p.bind(
qreg,
cond_jaxpr=cond_jaxpr,
body_jaxpr=body_jaxpr,
cond_nconsts=0,
body_nconsts=0,
nimplicit=0,
preserve_dimensions=True,
num_implicit_inputs=0
)
res = make_jaxpr(main)(AbstractQreg())
This results in
TypeError Traceback (most recent call last)
File ~/.config/spyder-py3/temp.py:2802
2800 )
2801
-> 2802 res = make_jaxpr(main)(AbstractQreg())
[... skipping hidden 14 frame]
File ~/.config/spyder-py3/temp.py:2791, in main(qreg)
2789 def main(qreg):
2790
-> 2791 while_res = while_p.bind(
2792 qreg,
2793 cond_jaxpr=cond_jaxpr,
File ~/miniforge3/envs/qrisp/lib/python3.11/site-packages/catalyst/jax_extras/tracing.py:949, in DynshapePrimitive.bind(self, *args, **params)
945 # invars = map(lambda t: t.val, tracers)
946 # outvars = map(lambda t: t.val, out_tracers)
947 # eqn = new_jaxpr_eqn(invars, outvars, self, params, [], source_info)
948 out_avals = [t.aval for t in out_tracers]
--> 949 eqn, out_tracers = trace.make_eqn(
950 tracers, out_avals, self, params, [], source_info, out_tracers=out_tracers
951 )
952 trace.frame.add_eqn(eqn)
953 return out_tracers if self.multiple_results else out_tracers.pop()
TypeError: DynamicJaxprTrace.make_eqn() got an unexpected keyword argument 'out_tracers'
If you know any way for me to circumvent this, I could already upgrade Qrisp to the latest Catalyst version. Thanks for your work!
- Dominant language
- Python
- Stars
- 234
- Forks
- 84
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 78
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PennyLaneAI/catalyst
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
PennyLaneAI/catalyst#3489 ·
Maintainers usually reply within 1 day
-
Fix platform tag for macOS wheelsMay be free again @sarehaskari17 claimed this 107 days ago, and no pull request is open. OpenCI/Build enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
PennyLaneAI/catalyst#2907 · 2 comments ·
Maintainers usually reply within 1 day
-
The docs page for `CompileOptions` is missing a description for the `target` attributePossibly taken @daxsh2803 claimed this 68 days ago. Opendocumentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
PennyLaneAI/catalyst#2653 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
PennyLaneAI/catalyst#3550 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 57/100
PennyLaneAI/catalyst#3497 ·
Maintainers usually reply within 1 day
All issues in PennyLaneAI/catalyst
Similar issues
-
docs(contributing): the two things that silently block a PRPossibly taken A pull request linked to this issue is open or already merged. Openavailable documentation good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 95/100
Nixitov/Riptide-Native#944 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
JTHCode/secretguard#24 ·
Maintainers usually reply within 1 day
-
area: middleware documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
omarelshamy25x/shamy-hijri#63 ·
Maintainers usually reply within 1 day