components/qnn.py
def ReUploadingVQC(inputs, entangling_weights, embedding_weights):
      '''
      A variational quantum circuit (VQC) with data re-uploading
      '''
      # Prepare all zero state
      all_zero_state = torch.zeros(n_qubits)
      qml.BasisStatePreparation(all_zero_state, wires=range(n_qubits))
      for i in range(qnn_layers):
        # Variational layer
        qml.StronglyEntanglingLayers(entangling_weights[i], wires=range(n_qubits))
        # Encoding layer
        features = inputs * embedding_weights[i]
        qml.AngleEmbedding(features=features, wires=range(n_qubits))
      # Last varitional layer
      qml.StronglyEntanglingLayers(entangling_weights[-1], wires=range(n_qubits))
      return [qml.expval(qml.PauliZ(wires=i)) for i in range(n_qubits)]

      A variational quantum circuit (VQC) with data re-uploading
      
A variational quantum circuit (VQC) with data re-uploading
A variational quantum circuit ( VQC ) with data re - uploading
def ReUploadingVQC(inputs, entangling_weights, embedding_weights):
      all_zero_state = torch.zeros(n_qubits)
      qml.BasisStatePreparation(all_zero_state, wires=range(n_qubits))
      for i in range(qnn_layers):
        qml.StronglyEntanglingLayers(entangling_weights[i], wires=range(n_qubits))
        features = inputs * embedding_weights[i]
        qml.AngleEmbedding(features=features, wires=range(n_qubits))
      qml.StronglyEntanglingLayers(entangling_weights[-1], wires=range(n_qubits))
      return [qml.expval(qml.PauliZ(wires=i)) for i in range(n_qubits)]
def ReUploadingVQC ( inputs , entangling_weights , embedding_weights ) : all_zero_state = torch . zeros ( n_qubits ) qml . BasisStatePreparation ( all_zero_state , wires = range ( n_qubits ) ) for i in range ( qnn_layers ) : qml . StronglyEntanglingLayers ( entangling_weights [ i ] , wires = range ( n_qubits ) ) features = inputs * embedding_weights [ i ] qml . AngleEmbedding ( features = features , wires = range ( n_qubits ) ) qml . StronglyEntanglingLayers ( entangling_weights [ - 1 ] , wires = range ( n_qubits ) ) return [ qml . expval ( qml . PauliZ ( wires = i ) ) for i in range ( n_qubits ) ]
A variational quantum circuit (VQC) with data re-uploading
A variational quantum circuit ( VQC ) with data re - uploading
'''
      A variational quantum circuit (VQC) with data re-uploading
      ''' # Prepare all zero state # Variational layer # Encoding layer # Last varitional layer
inputs
entangling_weights
embedding_weights