Hybrid quantum - classical layer definition
| 80 | |
| 81 | |
| 82 | class QuantumLayer(nn.Module): |
| 83 | """ Hybrid quantum - classical layer definition """ |
| 84 | |
| 85 | def __init__(self,num_qubits, backend, shift, copies=1000): |
| 86 | super(QuantumLayer, self).__init__() |
| 87 | self.q_circuit = QuantumCircuit(num_qubits, backend, copies) |
| 88 | self.shift = shift |
| 89 | |
| 90 | def forward(self, input): |
| 91 | return QuantumFunction.apply(input, self.q_circuit, self.shift) |
| 92 | |
| 93 | |
| 94 | class QCNNet(nn.Module): |