qml.templates.layers.StronglyEntanglingLayers

StronglyEntanglingLayers(weights, wires, ranges=None, imprimitive=<class 'pennylane.ops.qubit.CNOT'>)[source]

Layers consisting of single qubit rotations and entanglers, inspired by the circuit-centric classifier design arXiv:1804.00633.

The argument weights contains the weights for each layer. The number of layers \(L\) is therefore derived from the first dimension of weights.

The 2-qubit gates, whose type is specified by the imprimitive argument, act chronologically on the \(M\) wires, \(i = 1,...,M\). The second qubit of each gate is given by \((i+r)\mod M\), where \(r\) is a hyperparameter called the range, and \(0 < r < M\). If applied to one qubit only, this template will use no imprimitive gates.

This is an example of two 4-qubit strongly entangling layers (ranges \(r=1\) and \(r=2\), respectively) with rotations \(R\) and CNOTs as imprimitives:

../../_images/layer_sec.png
Parameters
  • weights (array[float]) – array of weights of shape (:math:`L`, :math:`M`, 3)

  • wires (Sequence[int] or int) – qubit indices that the template acts on

  • ranges (Sequence[int]) – sequence determining the range hyperparameter for each subsequent layer; if None using \(r=l \mod M\) for the \(l\) wires.

  • imprimitive (pennylane.ops.Operation) – two-qubit gate to use, defaults to CNOT

Raises

ValueError – if inputs do not have the correct format