qailab.torch.qlayer#

Module with QLayer

Summary#

Classes:

QLayer

Base quantum layer class.

Reference#

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

Bases: Module

Base quantum layer class.

This layer will output 2^num_measured_qubits features, which represent the distribution of measurements from the underlying quantum circuit.

The bitstring order is [0, 1, 2, …, 2^num_measured_qubits-1]

theta_trainable: Tensor#
reset_parameters() None[source]#

Parameter reset

extra_repr() str[source]#

Return the extra representation of the module.

To print customized extra information, you should re-implement this method in your own modules. Both single-line and multi-line strings are acceptable.

forward(input_tensor: Tensor) Tensor[source]#

Forward run