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

instruction param position out of range when truncation is processed #1427

Closed
hhorii opened this issue Jan 17, 2022 · 0 comments · Fixed by #1428
Closed

instruction param position out of range when truncation is processed #1427

hhorii opened this issue Jan 17, 2022 · 0 comments · Fixed by #1428
Labels
bug Something isn't working

Comments

@hhorii
Copy link
Collaborator

hhorii commented Jan 17, 2022

Informations

  • Qiskit Aer version: 0.34.1
  • Python version: any
  • Operating system: 0.10.2

What is the current behavior?

The current parameterized qobj is not processed correctly when truncation is enabled.

Once truncation is processed, indices of parameters must be changed to skip truncated instructions.
However, the current implementation uses specified indices and then throw exception Invalid parameterized qobj: instruction param position out of range.

Steps to reproduce the problem

import numpy as np
from qiskit import transpile, QuantumCircuit
from qiskit.providers.aer import AerSimulator
from qiskit.circuit.library import RealAmplitudes

simulator = AerSimulator()

circuit = QuantumCircuit(10, 10)
circuit = circuit.compose(RealAmplitudes(10), range(10))
circuit = transpile(circuit, simulator)
for q in range(5):
    circuit.measure(q, q)

num_of_params = 10
param_map = {}
for param in circuit.parameters:
    param_values = [ np.random.random() for _ in range(num_of_params) ]
    param_map[param] = param_values

simulator.run(circuit, parameter_binds=[param_map]).result().success

What is the expected behavior?

No runtime exception when the above script runs.

Suggested solutions

Resolve parameters after truncation or resolve parameters with consideration of truncation results.

@hhorii hhorii added the bug Something isn't working label Jan 17, 2022
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

Successfully merging a pull request may close this issue.

1 participant