-
Notifications
You must be signed in to change notification settings - Fork 76
[BUG] Error in ECR gates processing in qml.from_qiskit method #614
Description
Describe the bug
When creating a pennylane circuit from a qiskit circuit using qml.from_qiskit method there's an error in the operation name processing in the converter.py file. The error parses ECR Gate operation name to Gate and states that Gate instruction is not supported by PennyLane. That's because Gate is not present in the QISKIT_OPERATION_MAP whereas ECR clearly is.
The ECR gates ends up ignored in the processed circuit.
To Reproduce
Steps to reproduce the behavior:
- Prepare a
qiskitcircuit with at least one ECR gate. - Run
qml.from_qiskitmethod on the circuit. - See error.
Expected behavior
ECR gate is processed correctly and is included in the final circuit.
Error
<...>/pennylane_qiskit/converter.py:582: UserWarning: pennylane_qiskit.converter: The Gate instruction is not supported by PennyLane, and has not been added to the template.
Hotfix
A quick hotfix for this issue is to include:
if instruction.name == "ecr":
instruction_name = "ECRGate"
after instruction_name = getattr(...) in line 502. However, I believe that this issue can be solved in a more general and elegant way.
Desktop (please complete the following information):
- OS: Tested on Windows 10, Kali Linux and MacOS.
- Version: pennylane-qiskit 0.40.0
Additional context
It's important, because all the publicly available IBM devices uses ECR Gate as their native two-qubit gate.
I believe I can take care of this issue, but I need some time to wrap up my other, work-related stuff first.