A PyTorch implementation of Quantum Weight Re-Mapping
In recent years, quantum machine learning has seen a substantial increase in the use of variational quantum circuits (VQCs). VQCs are inspired by artificial neural networks, which achieve extraordinary performance in a wide range of AI tasks as massively parameterized function approximators. VQCs have already demonstrated promising results, for example, in generalization and the requirement for fewer parameters to train, by utilizing the more robust algorithmic toolbox available in quantum computing. A VQCs' trainable parameters or weights are usually used as angles in rotational gates and current gradient-based training methods do not account for that. We introduce weight re-mapping for VQCs, to unambiguously map the weights to an interval of length
$ pip install qw-map
import pennylane as qml
from qw_map import tanh
from torch import Tensor
def circuit(ws: Tensor, x: Tensor):
qml.AngleEmbedding(x, rotation='X', wires=range(num_qubits))
qml.StronglyEntanglingLayers(tanh(ws), wires=range(num_qubits))
Kölle, M.; Giovagnoli, A.; Stein, J.; Mansky, M.; Hager, J. and Linnhoff-Popien, C. (2023). Improving Convergence for Quantum Variational Classifiers Using Weight Re-Mapping. In Proceedings of the 15th International Conference on Agents and Artificial Intelligence - Volume 2 , ISBN 978-989-758-623-1, ISSN 2184-433X, pages 251-258.TOD