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

Attribute Error in Reverse QGT #207

Closed
Gopal-Dahale opened this issue Oct 9, 2024 · 1 comment
Closed

Attribute Error in Reverse QGT #207

Gopal-Dahale opened this issue Oct 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Gopal-Dahale
Copy link

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.

@Gopal-Dahale Gopal-Dahale added the bug Something isn't working label Oct 9, 2024
@woodsp-ibm
Copy link
Member

This was brought up as an issue in

and was fixed by

This code has not yet been released - I note you refer to the released version 0.3.0 and indeed that has that issue, but it has already been corrected in the codebase here, just not released yet. As such this has already been fixed so I am closing this,

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

2 participants