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\).


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.

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

  • wires (Iterable or Wires) – Wires that the template acts on. Accepts an iterable of numbers or strings, or a Wires object.


ValueError – if inputs do not have the correct format