-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the issue with dispatching to jax.vmap with qjit(vmap) (#569)
This PR fixes the issue with compiling `catalyst.qjit(catalyst.vmap(fn))(*args, **kwargs)` For example, this example should pass now ``` py dev = qml.device("lightning.qubit", wires=1) @qml.qnode(dev) def circuit(x, y): qml.RX(jnp.pi * x[0] + y, wires=0) qml.RY(x[1] ** 2, wires=0) qml.RX(x[1] * x[2], wires=0) return qml.expval(qml.PauliZ(0)) def cost(x, y, z): return circuit(x, y) * z vmapped_cost = qjit(vmap(cost, in_axes=(0, 0, None))) x = jnp.array([[0.1, 0.2, 0.3], [0.4, 0.5, 0.6], [0.7, 0.8, 0.9]]) y = jnp.array([jnp.pi, jnp.pi / 2, jnp.pi / 4]) vmapped_cost(x, y, 1) ```
- Loading branch information
1 parent
5d4f7a9
commit c2b7c11
Showing
3 changed files
with
30 additions
and
4 deletions.
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