Pennylane layer templates circuit


I want to see what’s inside the Random layer circuit. How to decompose the whole layer, so that I can study each gate.

dev = qml.device('lightning.qubit', wires=(0,1,2,3))

def circuit():
    qml.RandomLayers(rand_params, wires=list(range(4)))
    return qml.expval(qml.PauliZ(0))

fig, ax = qml.draw_mpl(circuit)()

Hello @Priyansh !

In that case, I would suggest taking a look at the Random Layers documentation. Also, if you would like to visualize the circuit with more details, you can choose the expansion_strategy in qml.draw_mpl that you find more convenient. You can find more details here.

I hope this helps! :slight_smile:

1 Like