-
Notifications
You must be signed in to change notification settings - Fork 625
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Context:** This PR adds a `UnitaryToRotInterpreter` to apply the `unitary_to_rot` transform natively to `plxpr`. **Description of the Change:** * Add `UnitaryToRotInterpreter` to transform `plxpr` **Benefits:** `unitary_to_rot` can be applied natively to plxpr. ```python qml.capture.enable() import jax U1 = qml.Rot(1.0, 2.0, 3.0, wires=0) @qml.capture.expand_plxpr_transforms @qml.transforms.unitary_to_rot def f(U1): qml.X(0) qml.QubitUnitary(U1, 0) qml.Y(0) return qml.expval(qml.Z(0)) >>> jaxpr = jax.make_jaxpr(f)(U1.matrix()) >>> tape = qml.tape.plxpr_to_tape(jaxpr.jaxpr, jaxpr.consts, U1.matrix()).operations >>> pprint.pprint(tape) [X(0), RZ(Array(1., dtype=float32), wires=[0]), RY(Array(2., dtype=float32), wires=[0]), RZ(Array(3., dtype=float32), wires=[0]), Y(0)] ``` **Possible Drawbacks:** None identified. [sc-83556] --------- Co-authored-by: Pietropaolo Frisoni <pietropaolo.frisoni@xanadu.ai> Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
- Loading branch information
1 parent
67fbcba
commit 65c52a8
Showing
3 changed files
with
601 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
Oops, something went wrong.