The repository contains codes for quantum Wasserstein GAN framework and its applications proposed in the following reference:
Shouvanik Chakrabarti, Yiming Huang, Tongyang Li, Soheil Feizi, and Xiaodi Wu, Quantum Wasserstein Generative Adversarial Networks, NeurIPS 2019.
We listed 4 applications which using quantum Wasserstein GAN framework as follows
- Learning pure state Learn the pure state generated by applying parameterized Pauli gates on each qubit.
- Learning mixed state Learn the mixed state , in which each pure state is generated by the same method mentioned in 1. is a random number between 0 and 1, and .
- Learning pure state with noise Add gaussian noise to the gradient of each parameters. and the generator circuit is constructed by the same ansatz used in training hybrid algorithm on iron-trap quantum computer('Training of Quantum Circuits on a Hybrid Quantum Computer').
- Hamiltonian Simulation Learn the pure state generated by applying the unitary operations which restricted by the Hamiltonian dynamics on maximually entangled state. Here we focus on the Hamiltonian of one-dimensional nearest-neighbor Heisenberg model with a random magnetic field in the z direction.
- Create an instance of Quantum Circuit
Such as we construct a quantum circuit as the generator:
from base_notation import * qcircuit = Quantum_Circuit(system_size, "generator") # create an instance of Quantum Circuit
- Adding quantum gates to quantum circuit, such as:
qcircuit.add(Quantum_Gate("X", i, angle=0.5000 * np.pi)) # add parameterized X Rotation gate with 0.5*pi on ith wire
- Create an instance of Generator
Such as creating the Generator of 2 qubits system
system_size = 2 gen = Generator(system_size) # create an instance of generator of 2 qubits system
- Create the quantum circuit and set it as the variational quantum circuit of the generator.
qc = construct_qcircuit(qc,size) # create an instance of system gen.set_qcircuit(qc) # set qc as the circuit of generator
- Define the Pauli matrices set.
As the discriminator is represented as linear combination of tensor products of simple Pauli matrices, we first define the Pauli matrices set
herm = [I, X, Y, Z]
- Create an instance of Discriminator
dis = Discriminator(herm, system size)
Update the parameters of generator and discriminator alternativly until the fidelity between the generated states and target state approximate to 1.
dis.update_dis(gen,real_state) #update the parameters of the discriminator
gen.update_gen(dis,real_state) #update the parameters of the generator
All the codes have dependencies on following python library:
- numpy 1.14.5
- scipy 1.1.0
- matplotlib 3.0.2
If you use our code in your research or wish to refer to the baseline results, please use the following BibTeX entry.
@inproceedings{chakrabarti2019quantum,
title={Quantum wasserstein generative adversarial networks},
author={Chakrabarti, Shouvanik and Yiming, Huang and Li, Tongyang and Feizi, Soheil and Wu, Xiaodi},
booktitle={Advances in Neural Information Processing Systems},
pages={6778--6789},
year={2019}
}
Distributed under the MIT License. See LICENSE for more information.