SELAnsatz#
- class pyqit.ansatzes.SELAnsatz(n_qubits: int, n_layers: int = 2)[source]#
Bases:
BaseAnsatzStrongly entangling layers of Schuld et al. (2020).
Wraps PennyLane’s StronglyEntanglingLayers. Each layer applies three rotations to every qubit, then a CNOT layer whose range grows with the layer index. The weights are one tensor, weights, of shape (n_layers, n_qubits, 3).
- Parameters:
n_qubits (int)
n_layers (int, default 2)
References
Schuld, Bocharov, Svore, Wiebe, “Circuit-centric quantum classifiers”, Phys. Rev. A 101, 032308 (2020).
Examples
>>> from pyqit.ansatzes import SELAnsatz >>> from pyqit.models import VQCClassifier >>> model = VQCClassifier(n_qubits=4, n_layers=3, ansatz=SELAnsatz)
- build_circuit(weights)[source]#
Construct and apply the strongly entangling layers to the quantum circuit.
- Parameters:
weights (dict) – A dictionary containing the parameter tensors. Must include the key “weights” with a tensor of shape (n_layers, n_qubits, 3).
- get_circuit_func()#
Returns the bound method to be passed to a QNode.