mit-han-lab/torchquantum

A PyTorch-based framework for Quantum Classical Simulation, Quantum Machine Learning, Quantum Neural Networks, Parameterized Quantum Circuits with support for easy deployments on real quantum computers.

What it solves

TorchQuantum is a framework for simulating quantum computations on classical hardware using PyTorch. It addresses the challenge of designing, training, and debugging quantum circuits—particularly parameterized quantum circuits—by integrating them directly into the PyTorch ecosystem, allowing for faster simulation and easier deployment to real quantum hardware.

How it works

The library provides a QuantumDevice class to store statevectors and a set of quantum gate functions and operators. It leverages PyTorch's autograd for automatic gradient computation and supports batch mode processing on both CPUs and GPUs. This allows users to construct hybrid classical-quantum models where quantum layers are treated as trainable PyTorch modules.

Who it’s for

It is designed for researchers working on quantum algorithm design, quantum machine learning (QML), quantum neural networks, parameterized quantum circuit training, and quantum optimal control.

Highlights

  • PyTorch Integration: Uses dynamic computation graphs and autograd for seamless integration with classical deep learning workflows.
  • GPU Acceleration: Supports statevector and pulse simulation on GPUs, scaling up to 30+ qubits across multiple GPUs.
  • Hybrid Modeling: Simplifies the construction of hybrid classical-quantum models.
  • Hardware Deployment: Includes plugins for easy deployment of simulated circuits to real quantum devices, such as IBMQ.
  • Broad Application: Used in tasks ranging from MNIST classification to Variational Quantum Eigensolver (VQE) tasks.