qiskit-algorithms
qiskit-algorithms copied to clipboard
Attribute Error in Reverse QGT
Environment
- Qiskit Algorithms version: 0.3.0
- Python version: 3.10.0
- Operating system: Ubuntu 22.04.5 LTS
What is happening?
When using ReverseQGT
, we get the following error:
AttributeError: 'QuantumCircuit' object has no attribute '_parameter_table'
How can we reproduce the issue?
from qiskit.circuit.library import TwoLocal
from qiskit_algorithms.gradients import ReverseQGT
import numpy as np
n_qubits = 1
qc = TwoLocal(
n_qubits,
["rx"],
["cx"],
"linear",
reps=1,
skip_final_rotation_layer=True,
flatten=True,
)
params = np.random.rand(qc.num_parameters)
grad = ReverseQGT()
grad.run([qc], [params]).result()
What should happen?
It should not throw this error.
Any suggestions?
We need to update the ReverseQGT
with the supported attributes of QuantumCircuit
for the latest qiskit version.