:py:mod:`kosmos.ml.models.vqc.encoding` ======================================= .. py:module:: kosmos.ml.models.vqc.encoding Classes ------- .. py:class:: VQCEncoding(input_dim: int, output_dim: int) Bases: :py:class:`abc.ABC` Feature encoding for the VQC. Initialize the encoding. :param input_dim: The input dimension of the model. :type input_dim: int :param output_dim: The output dimension of the model. :type output_dim: int | .. rubric:: Properties .. py:property:: num_qubits Number of required qubits. | .. rubric:: Methods .. py:method:: apply_operation(features: torch.Tensor, wires: collections.abc.Sequence[int]) -> None Apply the PennyLane operation for encoding. :param features: Input features. :type features: Tensor :param wires: Target wires. :type wires: Sequence[int] ---- .. py:class:: AngleEmbedding(input_dim: int, output_dim: int, rotation: Literal['X', 'Y', 'Z']) Bases: :py:class:`VQCEncoding` Angle embedding for the VQC. Initialize the angle embedding. :param input_dim: The input dimension of the model. :type input_dim: int :param output_dim: The output dimension of the model. :type output_dim: int :param rotation: The rotation to use for the angle embedding. :type rotation: Literal["X", "Y", "Z"] | .. rubric:: Properties .. py:property:: num_qubits Number of required qubits. | .. rubric:: Methods .. py:method:: apply_operation(features: torch.Tensor, wires: collections.abc.Sequence[int]) -> None Apply the angle embedding operation. :param features: Input features. :type features: Tensor :param wires: Target wires. :type wires: Sequence[int] ---- .. py:class:: AmplitudeEmbedding(input_dim: int, output_dim: int, pad_with: complex, *, normalize: bool) Bases: :py:class:`VQCEncoding` Amplitude embedding for the VQC. Initialize the amplitude embedding. :param input_dim: The input dimension of the model. :type input_dim: int :param output_dim: The output dimension of the model. :type output_dim: int :param pad_with: The input is padded with this constant to size :math:`2^n`. :type pad_with: complex :param normalize: Whether to normalize the features. :type normalize: bool | .. rubric:: Properties .. py:property:: num_qubits Number of required qubits. | .. rubric:: Methods .. py:method:: apply_operation(features: torch.Tensor, wires: collections.abc.Sequence[int]) -> None Apply the amplitude embedding operation. :param features: Input features. :type features: Tensor :param wires: Target wires. :type wires: Sequence[int]