Skip to content

Commit

Permalink
Added checks for different transpiler types
Browse files Browse the repository at this point in the history
  • Loading branch information
OkuyanBoga committed Dec 12, 2024
1 parent 94ccb0a commit b630a1f
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 @@ -182,7 +182,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 b630a1f

Please sign in to comment.