Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] cancel_inverses is not jittable #6778

Open
1 task done
albi3ro opened this issue Jan 7, 2025 · 0 comments
Open
1 task done

[BUG] cancel_inverses is not jittable #6778

albi3ro opened this issue Jan 7, 2025 · 0 comments
Labels
bug 🐛 Something isn't working

Comments

@albi3ro
Copy link
Contributor

albi3ro commented Jan 7, 2025

Expected behavior

I expect cancel_inverses to be jittable.

Actual behavior

We get an error because we are trying to compare the equality of tracers.

Additional information

No response

Source code

@qml.transforms.cancel_inverses
@qml.qnode(qml.device('default.qubit'))
def circuit(x):
    qml.adjoint(qml.RX(x+0.1, 0))
    qml.RX(x,0)
    return qml.expval(qml.Z(0))

jax.jit(circuit)(jax.numpy.array(0.5))

Tracebacks

TracerBoolConversionError: Attempted boolean conversion of traced array with shape bool[]..
The error occurred while tracing the function circuit at /var/folders/k1/0v_kvphn55lgf_45kntf1hqm0000gq/T/ipykernel_91848/3926972727.py:1 for jit. This concrete value was not available in Python because it depends on the value of the argument x.
See https://jax.readthedocs.io/en/latest/errors.html#jax.errors.TracerBoolConversionError

System information

master

Existing GitHub issues

  • I have searched existing GitHub issues to make sure the issue does not already exist.
@albi3ro albi3ro added the bug 🐛 Something isn't working label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant