:py:mod:`kosmos.ml.models.vqc.circuit.pennylane_circuit` ======================================================== .. py:module:: kosmos.ml.models.vqc.circuit.pennylane_circuit Classes ------- .. py:class:: PennyLaneParameterizedCircuit(circuit_runner: kosmos.circuit_runner.pennylane_runner.PennyLaneRunner, encoding: kosmos.ml.models.vqc.encoding.encoding.VQCEncoding, num_layers: int, weight_mapping_func: kosmos.ml.typing.TensorMapping | None, input_mapping_func: kosmos.ml.typing.TensorMapping | None, output_scaling_parameter: torch.Tensor | None, bias_parameter: torch.Tensor | None, *, data_reuploading: bool) Bases: :py:class:`kosmos.ml.models.vqc.circuit.circuit.ParameterizedCircuit` Parameterized quantum circuit using PennyLane. Initialize the circuit. :param circuit_runner: The PennyLane circuit runner. :type circuit_runner: PennyLaneRunner :param encoding: The VQC encoding. :type encoding: VQCEncoding :param num_layers: The number of variational layers. :type num_layers: int :param weight_mapping_func: The mapping function for the weights. :type weight_mapping_func: TensorMapping | None :param input_mapping_func: The mapping function for the inputs. :type input_mapping_func: TensorMapping | None :param output_scaling_parameter: The output scaling parameter. :type output_scaling_parameter: torch.Tensor | None :param bias_parameter: The bias parameter. :type bias_parameter: torch.Tensor | None :param data_reuploading: Whether to use data re-uploading. :type data_reuploading: bool | .. rubric:: Methods .. py:method:: expect_z(weights: torch.Tensor, x: torch.Tensor) -> torch.Tensor Execute the circuit and calculate Z expectation values. :param weights: Weights tensor. :type weights: torch.Tensor :param x: Input tensor. :type x: torch.Tensor :returns: Z expectation values. :rtype: torch.Tensor .. py:method:: forward_circuit(x: torch.Tensor, weights: torch.Tensor) -> torch.Tensor Compute model outputs for inputs and weights. :param x: Input tensor. :type x: torch.Tensor :param weights: Weights tensor. :type weights: torch.Tensor :returns: Output tensor. :rtype: torch.Tensor