AmplitudeEmbedding#

class pyqit.core.embeddings.AmplitudeEmbedding(n_qubits: int, normalize: bool = True, pad_with: float = 0.0)[source]#

Bases: BaseEmbedding

Features as state amplitudes, PennyLane’s AmplitudeEmbedding.

n_qubits wires carry up to 2 ** n_qubits features, so four qubits take sixteen. The DataModule zero-pads each row to that width and L2-normalizes it. Wider input raises.

Parameters:
  • n_qubits (int)

  • normalize (bool, default True) – Passed to PennyLane’s template, which renormalizes the state vector.

  • pad_with (float, default 0.0) – Passed to PennyLane’s template, which pads a short feature vector with this value.

Examples

>>> from pyqit.core import AmplitudeEmbedding
>>> from pyqit.models import VQCClassifier
>>> model = VQCClassifier(n_qubits=4, encoder=AmplitudeEmbedding)
forward(inputs)[source]#

Encode inputs into amplitudes. Expects 2 ** n_qubits features.

classmethod get_test_params()[source]#

List constructor kwargs used to parametrize this class in the test suite.