AmplitudeEmbedding

Module: pennylane.templates.embeddings

AmplitudeEmbedding(features, wires, pad=False, normalize=False)[source]

Encodes \(2^n\) features into the amplitude vector of \(n\) qubits.

If the total number of features to embed are less than the \(2^n\) available amplitudes, non-informative constants (zeros) can be padded to features. To enable this, the argument pad should be set to True.

The L2-norm of features must be one. By default, AmplitudeEmbedding expects a normalized feature vector. The argument normalize can be set to True to automatically normalize it.

Note

AmplitudeEmbedding uses PennyLane’s QubitStateVector and only works in conjunction with devices that implement this function.

Parameters:
  • features (array) – input array of shape (2**n,)
  • wires (Sequence[int]) – sequence of qubit indices that the template acts on
  • pad (Boolean) – controls the activation of the padding option
  • normalize (Boolean) – controls the activation of automatic normalization