1
$\begingroup$

For some reason I get the following error when attempting to find the inverse of the EfficientSU2 VQE variational form:

TypeError: 'NoneType' object is not reversible

My code is as follows:

var_form = EfficientSU2(6, entanglement="linear")
var_form_inv = var_form.inverse() # error thrown of this line

Is there a bug in the implementation of the inverse method? and if so how can I implement a working inverse function?

Note qiskit.__qiskit_version__:

{'qiskit-terra': '0.15.2',
 'qiskit-aer': '0.6.1',
 'qiskit-ignis': '0.4.0',
 'qiskit-ibmq-provider': '0.9.0',
 'qiskit-aqua': '0.7.5',
 'qiskit': '0.21.0'}
$\endgroup$
  • $\begingroup$ Could you open an issue for that on Qiskit Terra's GitHub? That should be fixed soon! $\endgroup$ – Cryoris Sep 28 at 9:35
2
$\begingroup$

EfficientSU2 is a BlueprintCircuit and does not populates its internal data field until you try to access them.

In this case, when you are calling the inverse function the data are still empty (None) and this is the error you are getting. It is probably a bug and should be fixed.

Nevertheless, as a workaround for now you can try:

var_form = EfficientSU2(6, entanglement="linear")
# build the circuit
var_form._build() 
# or just print it
print(var_form)
var_form_inv = var_form.inverse() 
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.