For example, consider this circuit:
dev = qml.device('default.qubit', wires=2, shots=10)
Will the device combine the two rotation gates into one?
Is there a way to specify if we want the device to optimize the circuit or not?
Will using a
qml.Barrier gate prevent optimization?
Hi @ankit27kh! It is up to the device whether optimizations are implemented. The current built-in PennyLane simulators (
lightning.qubit) do not, I believe, modify the circuit — they implement every gate as is. However, some devices (especially hardware devices) may transpile before execution.
Note that you can use our compilation transforms if you would like to optimize a circuit before it is sent to the device:
0: ──RX(2.00)─╭X─┤ Probs
Hey @josh, I was asking about PennyLane devices. Thanks for the clarification.