When the conditional argument is False, i.e. when dynamic circuits are not used, a cz gate should be applied to adjacent qubits to perform the pooling function. The adjacent qubits must be in pairs, (0, 1), (1, 2) or groups (0, 1, 2), (2, 3, 4), where the phase_bits are 1, 2 and 1, 3 respectively.
However, in the current implementation of the QuantumPoolingLayer(s) when the num_qubits is odd and conditional = False, a cz is not getting applied to the last qubit. This can also be seen in the unit test test_pooling_layer.py as below,
https://github.com/SaashaJoshi/quantum-image-processing/blob/828a9297f9fa1976f531b23c98ad05623c2a1390/tests/neural_networks/layers/test_pooling_layer.py#L132-L140
To pinpoint the origin of the error, the for loop here generates an incorrect group of qubits for the cz gate to be applied on.
https://github.com/SaashaJoshi/quantum-image-processing/blob/828a9297f9fa1976f531b23c98ad05623c2a1390/quantum_image_processing/neural_networks/layers/pooling_layer.py#L152-L156
While it is sure that this bug occurs in QuantumPoolingLayer3, it still needs to be verified if QuantumPoolingLayer2 shows similar behaviour.
This bug was discovered after #39 was closed.