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
Can't simulate circuits using SamplerV2. Error: "AttributeError: '_SingletonHGate' object has no attribute 'parameters'" #12391
Comments
Sampler.run call looks wrong. We have updated the error message #12031 and will be released as Qiskit 1.1 soon. |
I'll close this as expected/solved, but feel free to reopen if there's more to discuss. |
Hello, by adding the instruction
A new error I tried to transpile the circuit by doing:
And also including the target:
But in both cases the error persists. Thanks! |
You can add instructions to target. But, the resulting circuit does not work on a remote device because you cannot modify the target of the remote device. |
Thank you for responding, If I don't add any instruction and then I simply transpile the circuit, I got this error: The transpilation was done like this:
Thank you |
I suggest you look at the At the moment you are defining some custom |
Thank you for replying Jake, Basically my program is using the SWAP routine to compute the inner product between two vectors A and B using amplitude encoding, using these states: Just to create the issue, I just copied directly an example of previously computed values of both states for two random A and B vectors. I used instead initialize:
And then to simulate the circuit:
But it's just now that I try to update the code to current Qiskit version that I'm struggling to make it work. |
Your working examples don't appear to be much to do with new versions of Qiskit and more because you're simply using a different backend. The Runtime Aer also provides Sampler implementations (in |
Environment
What is happening?
This issue is a continuation of the #12388.
Basically, when I have a transpiled circuit and I want to simulate it using the library SamplerV2, it throws the error
AttributeError: '_SingletonHGate' object has no attribute 'parameters'
.How can we reproduce the issue?
The code is the following one:
And the output of the circuit:
Then I added the instructions to the backend and transpiled the circuit:
And the transpiled circuit look like this:
Nevertheless, when I try to run the circuit with SamplerV2, a new error appears:
The error is:
AttributeError: 'RZGate' object has no attribute 'parameters'
The same happens if i choose
pm = generate_preset_pass_manager(optimization_level=0, backend=backend)
instead (this doesn't modify the initial circuit structure or gates). And now the error is similar but with another gate:AttributeError: '_SingletonHGate' object has no attribute 'parameters'
What should happen?
The Sampler object should be able to simulate the circuit.
Any suggestions?
No response
The text was updated successfully, but these errors were encountered: