[BUG] Issue calculating qml.qinfo.transforms.quantum_fisher
#5197
Labels
bug 🐛
Something isn't working
qml.qinfo.transforms.quantum_fisher
#5197
Expected behavior
Hello! I’m currently trying to use
qml.qinfo.transforms.quantum_fisher
to calculate the quantum Fisher information matrix (QFIM) of a certain circuit calledU1_qfi
. However, I’m having an issue with the calculation in Pennylane. So it seems like this error pertains to some variabler
which is empty and thusnp.stack()
doesn't work. To make this reproducible on your machine, theperceptron_qfi.H
used in theqml.evolve
method inU1_qfi
is a parameterized Hamiltonian for 5 wires given asAlso,
params_qfi
is just a JAX array of parameters which has a number of elements that depends onL_qfi
. For the case ofL_qfi=1
,params_qfi
is a JAX array with four elements. WhenL_qfi=2
,params_qfi
has eight elements.Actual behavior
The QFIM isn't calculated due to the
np.stack()
error.Additional information
A more minimal example of the problem is
with the output as
While this ran, it didn’t consider any of the parameters trainable because jax tracks trainability information in a different way. You will just need to update when it considers a parameter trainable or not.
Source code
Tracebacks
System information
Existing GitHub issues
The text was updated successfully, but these errors were encountered: