-
Notifications
You must be signed in to change notification settings - Fork 595
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BugFix] - PennyLane raises an informative error if running circuit(s…
…) with dynamic tracers as wires (#6405) **Context:** Pennylane provides incorrect results or non-informative errors (depending on the circumstances) when working with `@jax.jit` and dynamic wires (that is, JAX tracers) at the same time. For example: ``` dev = qml.device("default.qubit") @jax.jit @qml.qnode(dev) def circuit(input_wires): qml.Hadamard(input_wires[1]) return qml.probs(wires=[0, 1]) circuit([0, 1]) ``` **Description of the Change:** Pennylane raises an informative error in the `validate_device_wires` transform to inform the user that abstract wires are not currently supported. We cannot raise this error in the `Wires` class since this would be a problem for Catalyst. This solution should not (hopefully) cause issues in other repositories. **Benefits:** This prevents non-informative errors and, most importantly, wrong results. **Possible Drawbacks:** This change could potentially break existing code(s) that somehow used abstract wires and for some reason they worked fine. **Related GitHub Issues:** #6380 **Related ShortCut Stories:** [sc-75756]
- Loading branch information
1 parent
35a5996
commit 056bb92
Showing
4 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters