qml.templates.embeddings.BasisEmbedding

BasisEmbedding(features, wires)[source]

Encodes \(n\) binary features into a basis state of \(n\) qubits.

For example, for features=np.array([0, 1, 0]), the quantum system will be prepared in state \(|010 \rangle\).

Warning

BasisEmbedding calls a circuit whose architecture depends on the binary features. The features argument is therefore not differentiable when using the template, and gradients with respect to the argument cannot be computed by PennyLane.

Parameters
  • features (array) – binary input array of shape (n, )

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

Raises

ValueError – if inputs do not have the correct format