CVNeuralNetLayer

Module: pennylane.templates.layers

CVNeuralNetLayer(theta_1, phi_1, varphi_1, r, phi_r, theta_2, phi_2, varphi_2, a, phi_a, k, wires)[source]

A layer of interferometers, displacement and squeezing gates mimicking a neural network, as well as a Kerr gate nonlinearity.

The layer acts on the \(M\) wires modes specified in wires, and includes interferometers of \(K=M(M-1)/2\) beamsplitters.

This example shows a 4-mode CVNeuralNet layer with squeezing gates \(S\), displacement gates \(D\) and Kerr gates \(K\). The two big blocks are interferometers of type pennylane.templates.layers.Interferometer:

../_images/layer_cvqnn.png

Note

The CV neural network architecture includes Kerr operations. Make sure to use a suitable device, such as the strawberryfields.fock device of the PennyLane-SF plugin.

Parameters:
  • theta_1 (array[float]) – length \((K, )\) array of transmittivity angles for first interferometer
  • phi_1 (array[float]) – length \((K, )\) array of phase angles for first interferometer
  • varphi_1 (array[float]) – length \((M, )\) array of rotation angles to apply after first interferometer
  • r (array[float]) – length \((M, )\) array of squeezing amounts for Squeezing operations
  • phi_r (array[float]) – length \((M, )\) array of squeezing angles for Squeezing operations
  • theta_2 (array[float]) – length \((K, )\) array of transmittivity angles for second interferometer
  • phi_2 (array[float]) – length \((K, )\) array of phase angles for second interferometer
  • varphi_2 (array[float]) – length \((M, )\) array of rotation angles to apply after second interferometer
  • a (array[float]) – length \((M, )\) array of displacement magnitudes for Displacement operations
  • phi_a (array[float]) – length \((M, )\) array of displacement angles for Displacement operations
  • k (array[float]) – length \((M, )\) array of kerr parameters for Kerr operations
  • wires (Sequence[int]) – sequence of mode indices that the template acts on