SaashaJoshi / piQture

piQture: A quantum machine learning library for image processing.
https://saashajoshi.github.io/piQture/
Apache License 2.0
20 stars 10 forks source link

Update Pooling layer to perform measurements in two of the three adjacent qubits; as mentioned in the referred paper. #9

Closed SaashaJoshi closed 8 months ago

SaashaJoshi commented 9 months ago

Currently, the pooling layer considers two adjacent qubits and applies a dynamic circuit. It measures one of the qubits and a controlled phase gate on the other. However, as given in the reference paper, this measurement can also be performed on two adjacent qubits. Two qubits are measured, and corresponding controlled phase gates are applied to the qubit.

https://github.com/SaashaJoshi/quantum-image-processing/blob/2d21202f013546b7894bbbc90f368ae9ab2f87d6/quantum_image_processing/models/neural_networks/convolutional/qcnn.py#L121-L123

This flexibility in the number of qubits to be measured is yet to be implemented. This feature (perhaps) corresponds to the size of strides in a classical pooling layer.

Originally posted by @SaashaJoshi in https://github.com/SaashaJoshi/quantum-image-processing/issues/6#issuecomment-1806276679

SaashaJoshi commented 9 months ago

Updating this might require the addition of an argument that asks the user if they want to consider 1 or 2 adjacent qubits for the QuantumPoolingLayer to perform measurements on. Instead, the existing layer can be renamed to QuantumPoolingLayer2 and this new feature could be added as a separate class QuantumPoolingLayer3.