Skip to content

Commit

Permalink
Remove clbits from QuantumNeuralNetwork class (#63)
Browse files Browse the repository at this point in the history
* remove clbits as sampler primitive cannot take clbits during training

* remove classical register from tests
  • Loading branch information
SaashaJoshi authored Mar 14, 2024
1 parent 9455221 commit 76f1718
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions piqture/neural_networks/quantum_neural_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ def __init__(self, num_qubits: int):
raise ValueError("The input num_qubits must be at least 1.")

self.num_qubits = num_qubits
self._circuit = QuantumCircuit(self.num_qubits, self.num_qubits)
self._circuit = QuantumCircuit(self.num_qubits)
self.qr = self._circuit.qubits
self.cr = self._circuit.clbits
# Remove clbits as Sampler cannot take clbits.
# self.cr = self._circuit.clbits

@property
def circuit(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/neural_networks/test_qcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_value_num_qubits(self, num_qubits):
def test_circuit_property(self, num_qubits):
"""Tests the QCNN circuit."""
qcnn = QCNN(num_qubits)
assert qcnn.circuit == QuantumCircuit(num_qubits, num_qubits)
assert qcnn.circuit == QuantumCircuit(num_qubits)

@pytest.mark.parametrize(
"num_qubits, operations",
Expand Down

0 comments on commit 76f1718

Please sign in to comment.