Skip to content

Commit

Permalink
Extended support for different V2 transpilers from different backends…
Browse files Browse the repository at this point in the history
…. (backport #879) (#882)

* Added checks for different transpiler types (#879)

(cherry picked from commit e1859dd)

* Update constraints.txt

---------

Co-authored-by: M. Emre Sahin <[email protected]>
Co-authored-by: Edoardo Altamura <[email protected]>
  • Loading branch information
3 people authored Dec 19, 2024
1 parent a96727c commit a713dde
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion qiskit_machine_learning/neural_networks/estimator_qnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ def __init__(
self.num_virtual_qubits = circuit.num_qubits
else:
circuit = pass_manager.run(circuit)
self.num_virtual_qubits = circuit.layout._input_qubit_count
if hasattr(circuit.layout, "_input_qubit_count"):
self.num_virtual_qubits = circuit.layout._input_qubit_count
else:
self.num_virtual_qubits = circuit.num_qubits

self._org_circuit = circuit

Expand Down
5 changes: 4 additions & 1 deletion qiskit_machine_learning/neural_networks/sampler_qnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@ def __init__(
self.num_virtual_qubits = circuit.num_qubits
else:
circuit = pass_manager.run(circuit)
self.num_virtual_qubits = circuit.layout._input_qubit_count
if hasattr(circuit.layout, "_input_qubit_count"):
self.num_virtual_qubits = circuit.layout._input_qubit_count
else:
self.num_virtual_qubits = circuit.num_qubits

self._org_circuit = circuit

Expand Down

0 comments on commit a713dde

Please sign in to comment.