{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "flsf21MK3KTd" }, "source": [ "# Apply parameters shift rules to train quantum model using [TorchQuantum](https://github.com/mit-han-lab/torchquantum).\n", "
\n", "\n", "
\n", "\n", "Tutorial Author: Zirui Li, Hanrui Wang\n" ] }, { "cell_type": "markdown", "metadata": { "id": "kvTdBipl6gqY" }, "source": [ "###Outline\n", "1. Introduction to Parameters Shift Rules.\n", "2. Train a model with parameters shift rules.\n", "3. A simple 2 qubit model for a simple 2 classification task.\n" ] }, { "cell_type": "markdown", "metadata": { "id": "qJv0wED75YTq" }, "source": [ "\n", "In this tutorial, you can learn parameters shift rules and how to use parameters shift rules to calculate gradients and use the gradient to train a model.\n", "\n", "##Introduction to Parameters Shift Rules\n", "\n", "###Back Propagation\n", "\n", "Previously, our quantum model was based on qiskit and pytorch. Once we did an inference of the model, pytorch will automatically build a computaional graph. We can calculate the gradients of each node in the computational graph in a reversed order based on the chain rule. This is called back propagation.\n", "