PennyLane Documentation



PennyLane is a cross-platform Python library for differentiable programming of quantum computers. Train a quantum computer the same way as a neural network.

During the month of November 2021 we’re hosting the Pennylane Quantum Carnival where you will get to collect tickets like the one below, and exchange them for prizes at the end of the month. Take note of the code in this ticket and try to collect them all!



  • Follow the gradient. Built-in automatic differentiation of quantum circuits.

  • Best of both worlds. Support for hybrid quantum and classical models; connect quantum hardware with PyTorch, TensorFlow, and NumPy.

  • Batteries included. Provides optimization and machine learning tools.

  • Device independent. The same quantum circuit model can be run on different backends. Install plugins to access even more devices, including Strawberry Fields, Amazon Braket, IBM Q, Google Cirq, Rigetti Forest, Microsoft QDK, and ProjectQ.

Getting started

For an introduction to quantum machine learning, we have several guides and resources available on our QML website, including What is QML?, frequently asked questions, a glossary of key concepts, and a curated selection of QML videos.

Then, take a deeper dive into quantum machine learning by exploring cutting-edge algorithms using PennyLane and near-term quantum hardware, with our collection of QML demonstrations.

You can also check out the Using PennyLane section for more details on the quantum operations, and to explore the available optimization tools provided by PennyLane. We also have a detailed guide on how to write your own PennyLane-compatible quantum device.

Finally, play around with the numerous devices and plugins available for running your hybrid optimizations—these include IBM Q, provided by the PennyLane-Qiskit plugin, as well as the Rigetti Aspen QPU provided by PennyLane-Forest.

How to cite

If you are doing research using PennyLane, please cite

Ville Bergholm, Josh Izaac, Maria Schuld, Christian Gogolin, M. Sohaib Alam, Shahnawaz Ahmed, Juan Miguel Arrazola, Carsten Blank, Alain Delgado, Soran Jahangiri, Keri McKiernan, Johannes Jakob Meyer, Zeyue Niu, Antal Száva, and Nathan Killoran. PennyLane: Automatic differentiation of hybrid quantum-classical computations. 2018. arXiv:1811.04968

Support and contribution

If you are having issues, please let us know by posting the issue on our GitHub issue tracker.

We encourage contributions — simply fork the PennyLane repository, and then make a pull request containing your contribution. All contributers to PennyLane will be listed as authors on the releases.

To chat directly with the team designing and building PennyLane, as well as members of our community — ranging from quantum machine learning researchers, to students, to those just interested in being a part of a rapidly growing industry — you can join our discussion forum.


PennyLane is free and open source, released under the Apache License, Version 2.0.