Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update directory structure for neural networks #27

Merged
merged 11 commits into from
Dec 14, 2023
Merged

Conversation

SaashaJoshi
Copy link
Owner

@SaashaJoshi SaashaJoshi commented Dec 14, 2023

This PR handles multiple tasks:

  1. Changes the directory structure of the neural_networks module
    A. This change led to several follow-up changes to tensor_network_circuits module. Major change was to replace img_dims with num_qubits such that the NN layers can be applied on to the circuit with the help of tensor_network_circuit objects.
  2. Split NN layer classes into different folders for clear organization of code.
    3. Add unit tests for QCNN and several NN layers. (separate PR)
  3. Add QuantumPooilingLayer3 to close Update Pooling layer to perform measurements in two of the three adjacent qubits; as mentioned in the referred paper. #9

@SaashaJoshi SaashaJoshi added this to the v0.0.2 milestone Dec 14, 2023
@SaashaJoshi SaashaJoshi changed the title Update directory structure for neural networks and add unit tests Update directory structure for neural networks Dec 14, 2023
@SaashaJoshi
Copy link
Owner Author

SaashaJoshi commented Dec 14, 2023

Currently, layers take an input unmeasured_bits of the type(dict) that stores the unmeasured qubits and clbits of the QNN circuit. The question is if this input should instead be a list with the index of the unmeasured qubits/clbits only. Having a list structure may save us from (redundantly) storing qubits and clbits on the same indices; since measurement means both the qubit and the corresponding clbit are used.

@SaashaJoshi
Copy link
Owner Author

Currently, layers take an input unmeasured_bits of the type(dict) that stores the unmeasured qubits and clbits of the QNN circuit. The question is if this input should instead be a list with the index of the unmeasured qubits/clbits only. Having a list structure may save us from (redundantly) storing qubits and clbits on the same indices; since measurement means both the qubit and the corresponding clbit are used.

Also, the inputs num_qubits and unmeasured_bits (or qubits in some PR commits) should be mutually inclusive since the layers are built on unmeasured qubits only.
So the len(unmeasured_qubits) = num_qubits, unless when unmeasured_qubits = None

@SaashaJoshi
Copy link
Owner Author

a540ab2
This commit follows up on several changes to tensor_network_circuits module. The major change was to replace img_dims with num_qubits such that the NN layers can be applied on to the circuit with the help of tensor_network_circuit objects.
The test files for these changes will be updated in another PR.

Comment on lines +35 to +37
self.qreg = QuantumRegister(self.num_qubits)
self.creg = ClassicalRegister(self.num_qubits)
self.circuit = QuantumCircuit(self.qreg, self.creg)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circuit initialization can be performed in the QuantumNeuralNetwork base class.

@SaashaJoshi SaashaJoshi merged commit 8d2ee1a into main Dec 14, 2023
4 of 8 checks passed
@SaashaJoshi SaashaJoshi deleted the nn-testing branch December 14, 2023 21:10
SaashaJoshi added a commit that referenced this pull request Dec 14, 2023
update tests for tensor network circuits after changes made in PR #27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant