PennyLaneAI / PennyLaneAI/catalyst
[Bug] The dynamic one-shot transform does not preserve pytree output of QNodes
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 234
- Forks
- 84
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 66
Description
dev = qml.device("lightning.qubit", wires=1, shots=20)
@qml.qjit
@qml.qnode(dev, mcm_method="one-shot")
def func(x):
qml.RX(x, wires=0)
m_0 = catalyst.measure(0, postselect=1)
return {"hi": qml.expval(qml.Z(0))}
>>> func(0.9)
array(1.)
Contributor guide
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.
Research direction
Start with the provided Python reproducer using qml.qjit, a one-shot QNode, and a dictionary return value. Trace the dynamic one-shot transform and QNode output handling, then verify that func(0.9) preserves the {"hi": ...} pytree structure instead of returning a scalar array.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100