RandomLayers

Module: pennylane.templates.layers

RandomLayers(weights, wires, ratio_imprim=0.3, imprimitive=<class 'pennylane.ops.qubit.CNOT'>, rotations=None, seed=42)[source]

A sequence of layers of type RandomLayer().

The number of layers \(L\) and the number \(k\) of rotations per layer is inferred from the first and second dimension of weights. The type of imprimitive (two-qubit) gate and rotations distributed randomly in the circuit can be chosen explicitly.

See RandomLayer() for details on the randomised behaviour.

Parameters:
  • weights (array[float]) – array of weights of shape (L, k),
  • wires (Sequence[int]) – sequence of qubit indices that the template acts on
Keyword Arguments:
 
  • ratio_imprim (float) – value between 0 and 1 that determines the ratio of imprimitive to rotation gates (default 0.3)
  • imprimitive (pennylane.ops.Operation) – two-qubit gate to use, defaults to CNOT
  • rotations (list[pennylane.ops.Operation]) – List of Pauli-X, Pauli-Y and/or Pauli-Z gates. The frequency determines how often a particular rotation type is used. Defaults to the use of all three rotations with equal frequency.
  • seed (int) – seed to generate random architecture