Closed erikrecio closed 8 months ago
hi @erikrecio, thanks for reporting this! I've opened a bugfix (linked above), and I'll let you know once it's accepted.
Do I have to wait until the next pennylane update or does this mean my code will run now? I'm not aware of how to download "the latest version", since "pip install --upgrade pennylane" didn't fix the issue.
hello again! you're correct, the latest pennylane installed from pip does not yet have the fix. Two things I'd recommend:
master
of PennyLane to have the fix included using pip install git+https://github.com/PennyLaneAI/pennylane.git
, or get a local editable version of PennyLanehappy hacking!
This is great, works like a charm and you solved it really quick. Thanks @timmysilv!!
Expected behavior
jax.jit can be wrapped around a default.mixed device with qml.QubitDensityMatrix() function.
Actual behavior
Error: TracerBoolConversionError: Attempted boolean conversion of traced array with shape bool[].. The error occurred while tracing the function variational_circuit_mixed at:9 for jit. This concrete value was not available in Python because it depends on the value of the argument state_ini.
Additional information
As you can see in the source code, the variational_circuit_qubit() works correctly, while variational_circuit_mixed() stumps upon an error due to the jit compilation. It's the same scenario, but with the mixed device it's not working and, as far as I understand, there should be compatibility between jax and the default.mixed device.
Source code
Tracebacks
System information
Existing GitHub issues