Quantum GANs with PennyLane
Overview
Quantum GANs with PennyLane
This PennyLane demo implements a Quantum Generative Adversarial Network (QGAN), adapting the adversarial-training paradigm of classical GANs to quantum circuits to learn and generate data distributions. A GAN pits two networks against each other: a generator that learns to produce realistic samples and a discriminator that learns to distinguish real from generated data, with the two improving through competition. In this demo the generator is built from quantum circuits, specifically a patched approach where several sub-generator circuits each produce part of the output so that limited-qubit circuits can generate higher-dimensional data. The tutorial implements the quantum generator in PennyLane, wraps it for training with PyTorch, pairs it with a classical discriminator, and trains the adversarial pair to generate handwritten-digit-like images, with quantum gradients provided by PennyLane's autodifferentiation. It walks through the patched-generator construction, the adversarial training loop, and visualizing the images the quantum generator learns to produce. By bringing generative adversarial learning to quantum circuits, the demo is an engaging, applied example of generative quantum machine learning in PennyLane.
Run it
pip install -r requirements.txt
python demo.py
Source and license
Imported from demonstrations_v2/tutorial_quantum_gans/demo.py in PennyLaneAI/demos at c52c0abeb5122218aa96b38eea848864cce7323f, under the Apache License 2.0. Original authors: Xanadu and the PennyLane community. The upstream LICENSE is included alongside this example.
This entry was created automatically from publicly available records. QCR links to public sources and only stores repository content where the license permits redistribution.
Versions
Cite all versions? Use the base QCR ID to always reference the latest version of this entry.
Join the Discussion
Comments (0)
No comments yet. Be the first to share your thoughts!