Simulators with Tensorflow support#
Pure Fock Simulator and Tensorflow#
Performs photonic simulations using Fock representation with pure states.
This simulator is similar to
PureFockSimulator, but it
calculates with Tensorflow to enable calculating the gradient.
The simulation (when executed) results in an instance of
Non-deterministic operations like
non-differentiable, please use a deterministic attribute of the resulting state
import tensorflow as tf alpha = tf.Variable(0.43) simulator = pq.TensorflowPureFockSimulator(d=1) with pq.Program() as program: pq.Q() | pq.Vacuum() pq.Q(0) | pq.Displacement(alpha=alpha) with tf.GradientTape() as tape: state = simulator.execute(program).state mean = state.mean_photon_number() gradient = tape.gradient(mean, [alpha])
- Supported preparations:
- Supported gates:
- Supported measurements:
- Supported channels: