This module contains templates for trainable ‘layers’ of quantum gates.

CV layers

Single layer

CVNeuralNetLayer(theta_1, phi_1, varphi_1, …) A layer of interferometers, displacement and squeezing gates mimicking a neural network, as well as a Kerr gate nonlinearity.
Interferometer(theta, phi, varphi, wires[, …]) General linear interferometer, an array of beamsplitters and phase shifters.

Multiple layers

CVNeuralNetLayers(theta_1, phi_1, varphi_1, …) A sequence of layers of type CVNeuralNetLayer(), as specified in [killoran2018continuous].

Qubit layers

Single layer

StronglyEntanglingLayer(weights, wires[, r, …]) A layer applying rotations on each qubit followed by cascades of 2-qubit entangling gates.
RandomLayer(weights, wires[, ratio_imprim, …]) A layer of randomly chosen single qubit rotations and 2-qubit entangling gates, acting on randomly chosen qubits.

Multiple layers

StronglyEntanglingLayers(weights, wires[, …]) A sequence of layers of type StronglyEntanglingLayer(), as specified in [schuld2018circuit].
RandomLayers(weights, wires[, ratio_imprim, …]) A sequence of layers of type RandomLayer().


To make the signature of templates resemble other quantum operations used in quantum circuits, we treat them as classes here, even though technically they are functions.