-
Notifications
You must be signed in to change notification settings - Fork 361
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
TypeError: (): incompatible function arguments. AerConfig, arg0: list[list[tuple[tuple[int, int], list[float]]]]) -> None #2195
Comments
Could you please provide full script to reproduce the issue? |
The full script of the code I want to branch is in this link to be branched , except that I am working on the latest updated libraries of qiskit, qiskit_aer, numpy, and torch. The execute function is deprecated already, thus we need to change it to run. I tried to attach the file as I modified it to work on the recent updates of the libraries, but it is not supported. in tab ## 3. Contruct QuantumCircuit Class, I modified run user defined function as the following:
When I try to run its following instructions
it shows the following error:
|
could you provide simple complete script (can be executed by |
I am sorry .. actually I didn't use it in a .py file.. and I was trying to re-run the jupyter notebook I shared its link earlier. Anyway, that was a real problem in the aerbackend.py file. Either correct or not, but this was the updates I made so that the notebook worked for me. `
` |
Informations
Maybe this is not considered a bug, but it stopped my work for a week while I was in many tries to solve it with no change except for different types of errors.
What is the current behavior?
`TypeError: (): incompatible function arguments. The following argument types are supported:
1. (self: qiskit_aer.backends.controller_wrappers.AerConfig, arg0: list[list[tuple[tuple[int, int], list[float]]]]) -> None
Invoked with: <qiskit_aer.backends.controller_wrappers.AerConfig object at 0x000001C4AAA431B0>, [[[(4, 0), 0.7853981852531433], [(5, 0), 0.7853981852531433], [(6, 0), 0.7853981852531433], [(7, 0), 0.7853981852531433], [(11, 0), 0.7853981852531433], [(12, 0), 0.7853981852531433], [(13, 0), 0.7853981852531433], [(14, 0), 0.7853981852531433]]]`
even if I changed it to
param_binds = [{str(self.thetas[k]) : params[k].item() for k in range(NUM_QUBITS)}]
, it keeps rejecting the second part for "TypeError: object of type 'float' has no len()", then with changing the second part toparam_binds = [{str(self.thetas[k]) : torch.Tensor([params[k].item()]) for k in range(NUM_QUBITS)}]
, TypeError: ParameterExpression with unbound parameters (dict_keys([Parameter(Theta0)])) cannot be cast to a float.now all my tries went to vain, and I need to use the updated versions of the libraries, because there are functions I need in my real project that is perfectly served with the new versions of the libraries.
Steps to reproduce the problem
I got the code from this repository , aiming to branch it but I need it to work first, so then I can add my updates on. However, in the function run, there is always this error no matter what how I change it, there will be an error.
`def run(self, i):
params = i
print('params = {}'.format(len(params)))
backend = Aer.get_backend('qasm_simulator')
'''
What is the expected behavior?
It is supposed to create the circuit and provide an illustration to it as it appears in the link above.
Suggested solutions
I know that the solution is to use the old versions, but I need the new versions in the same project too. Thus, I need to know what is the solution to represent the parameter list dynamically for the job to continue the work. Other files in the project link if using parameter lists like
param_binds = [{'theta': self.beta, 'phi': self.gamma}]
are working good. However, it always fails when it comes to dynamically assigning param_binds. Any solutions?The text was updated successfully, but these errors were encountered: