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.
https://torchquantum.org
MIT License
1.3k stars 197 forks source link

How to perform backprop on a quantum circuit #278

Open zohimchandani opened 3 months ago

zohimchandani commented 3 months ago

I am trying to understand how PyTorch recognizes a quantum circuit within a nn.Module and can perform backdrop on the gates in the circuit? What part of the code enables this and how does a circuit get turned into a computational graph which PyTorch can backprop on?

Thanks