Jump to Content

TensorFlow Quantum: A Software Framework for Quantum Machine Learning

Michael Broughton
Guillaume Verdon
Trevor McCourt
Antonio J. Martinez
Jae Hyeon Yoo
Sergei V. Isakov
Philip Massey
Ramin Halavati
Alexander Zlokapa
Evan Peters
Owen Lockwood
Andrea Skolik
Sofiene Jerbi
Vedran Djunko
Martin Leib
Michael Streif
David Von Dollen
Hongxiang Chen
Chuxiang Cao
Roeland Wiersema
Hsin-Yuan Huang
Alan K. Ho
Masoud Mohseni


We introduce TensorFlow Quantum (TFQ), an open source library for the rapid prototyping of hybrid quantum-classical models for classical or quantum data. This framework offers high-level abstractions for the design and training of both discriminative and generative quantum models under TensorFlow and supports high-performance quantum circuit simulators. We provide an overview of the software architecture and building blocks through several examples and review the theory of hybrid quantum-classical neural networks. We illustrate TFQ functionalities via several basic applications including supervised learning for quantum classification, quantum control, simulating noisy quantum circuits, and quantum approximate optimization. Moreover, we demonstrate how one can apply TFQ to tackle advanced quantum learning tasks including meta-learning, layerwise learning, Hamiltonian learning, sampling thermal states, variational quantum eigensolvers, classification of quantum phase transitions, generative adversarial networks, and reinforcement learning. We hope this framework provides the necessary tools for the quantum computing and machine learning research communities to explore models of both natural and artificial quantum systems, and ultimately discover new quantum algorithms which could potentially yield a quantum advantage.