Is there any way to print out the explicit state of the device at any point in the circuit?
Since PennyLane is designed to work with real hardware, this is not possible — we can only extract data we could expect to obtain in the lab, in this case measurement statistics such as expectation values, single shot samples, and variances.
However, if you are using a PennyLane simulated device, such as
strawberryfields.gaussian, etc., and it has been defined as
dev = qml.device("device.name", ...)
there are ways to obtain the wavefunction after a QNode has been executed:
default.gaussian: the wavefunction is accessible in
strawberryfields.gaussian: the engine is accessible in
dev.eng, and the state accessible in
forest.wavefunction: the state is accessible in
Since this is not a documented approach, every plugin is free to do this differently, and some plugin devices don’t even have wavefunctions to access, such as
forest.qvm. Automatic differentiation of these device wavefunctions is also not supported.
Hope this helps!