StronglyEntanglingLayers with two qubits


I am using StronglyEntanglingLayers to apply multiple layers of single qubit rotations and CNOT-entanglers. I realized that two CNOT gates are applied in each layer when I have only two wires, but I would like to apply it once only per layer.

Is there a reason why StronglyEntanglingLayers doesn’t handle scenarios with two wires like BasicEntanglerLayers? Many thanks!

Relevant pennylane code:


Hey @wongwsvincent,

An excellent question :slight_smile:

This is more a historical reason, BasicEntanglingLayers was coded up later when the issue of repeating the CNOT when we have 2 wires was not yet apparent to us.

I am in favour of changing the behaviour of StronglyEntanglingLayers! The best thing to do would be to open an issue where you explain what you would like to happen (also mention that this is already done in the other embedding). We can discuss in the issue how to go about changing it, since it will change people’s code. Either you or we can then make a PR!

Hi @Maria_Schuld,

Thanks for the explanation! I have opened an issue as you suggested.

The implementation seems straightforward enough for me to contribute. I am happy to make a PR when there’s no strong objection to the idea :slightly_smiling_face:

Wonderful, thanks so much!