qailab.torch.layers.regression#

Attempts at regression compatible layers

Summary#

Classes:

ArgmaxQLayer

This layer returns the most common bitstring sampled from the underlying quantum circuit.

ExpectedValueQLayer

This layer returns the expected value of a bitstring sampled from the underlying quantum circuit.

Reference#

class qailab.torch.layers.regression.ExpectedValueQLayer(circuit: QuantumCircuit, *, backend: QiskitBackend | None = None, shots: int = 1024, rescale_output: tuple[float, float] | None = None)[source]#

Bases: QLayer

This layer returns the expected value of a bitstring sampled from the underlying quantum circuit. The value is a floating point number in range <0, 2^num_measured_qubits - 1>

forward(input_tensor: Tensor) Tensor[source]#

Forward run

class qailab.torch.layers.regression.ArgmaxQLayer(circuit: QuantumCircuit, *, backend: QiskitBackend | None = None, shots: int = 1024)[source]#

Bases: QLayer

This layer returns the most common bitstring sampled from the underlying quantum circuit. The value is a whole number in range <0, 2^num_measured_qubits - 1>

forward(input_tensor: Tensor) Tensor[source]#

Forward run