Skip to content

Commit

Permalink
Merge pull request #197 from mit-han-lab/dev
Browse files Browse the repository at this point in the history
Major release v0.1.8
  • Loading branch information
Hanrui-Wang authored Feb 21, 2024
2 parents ea63947 + 497320c commit a5de610
Show file tree
Hide file tree
Showing 154 changed files with 33,371 additions and 17,464 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/functional_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package

on:
push:
pull_request:

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
python -m pip install flake8 pytest qiskit-aer qiskit_ibm_runtime
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
python -m pytest -m "not skip"
- name: Install TorchQuantum
run: |
pip install --editable .
- name: Test Examples
run: |
python3 examples/qubit_rotation/qubit_rotation.py --epochs 1
python3 examples/vqe/vqe.py --epochs 1 --steps_per_epoch 1
python3 examples/train_unitary_prep/train_unitary_prep.py --epochs 1
python3 examples/train_state_prep/train_state_prep.py --epochs 1
python3 examples/superdense_coding/superdense_coding_torchquantum.py
python3 examples/regression/run_regression.py --epochs 1
python3 examples/param_shift_onchip_training/param_shift.py
python3 examples/mnist/mnist_2qubit_4class.py --epochs 1
python3 examples/hadamard_grad/circ.py
python3 examples/encoder_examples/encoder_8x2ry.py
python3 examples/converter_tq_qiskit/convert.py
python3 examples/amplitude_encoding_mnist/mnist_new.py --epochs 1
python3 examples/amplitude_encoding_mnist/mnist_example.py --epochs 1
python3 examples/PauliSumOp/pauli_sum_op.py
python3 examples/regression/new_run_regression.py --epochs 1
python3 examples/quanvolution/quanvolution_trainable_quantum_layer.py --epochs 1
python3 examples/grover/grover_example_sudoku.py
python3 examples/param_shift_onchip_training/param_shift.py
python3 examples/quanvolution/quanvolution.py --epochs 1
python3 examples/quantum_lstm/qlstm.py --epochs 1
python3 examples/qaoa/max_cut_backprop.py --steps 1
python3 examples/optimal_control/optimal_control.py --epochs 1
python3 examples/optimal_control/optimal_control_gaussian.py --epochs 1
python3 examples/optimal_control/optimal_control_multi_qubit.py --epochs 1
python3 examples/save_load_example/save_load.py
python3 examples/mnist/mnist.py --epochs 1
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@


<p align="center">
<a href="https://github.com/mit-han-lab/torchquantum/blob/master/LICENSE">
<img alt="MIT License" src="https://img.shields.io/github/license/mit-han-lab/torchquantum">
</a>
<a href="https://torchquantum.readthedocs.io/">
<img alt="Documentation" src="https://img.shields.io/readthedocs/torchquantum/main">
</a>
<a href="https://github.com/mit-han-lab/torchquantum/blob/master/LICENSE">
<img alt="MIT License" src="https://img.shields.io/github/license/mit-han-lab/torchquantum">
</a>
<a href="https://join.slack.com/t/torchquantum/shared_invite/zt-1ghuf283a-OtP4mCPJREd~367VX~TaQQ">
<img alt="Chat @ Slack" src="https://img.shields.io/badge/slack-chat-2eb67d.svg?logo=slack">
</a>
Expand All @@ -25,7 +25,6 @@
<a href="https://qmlsys.mit.edu">
<img alt="Website" src="https://img.shields.io/website?up_message=qmlsys&url=https%3A%2F%2Fqmlsys.mit.edu">
</a>

<a href="https://pypi.org/project/torchquantum/">
<img alt="Pypi" src="https://img.shields.io/pypi/v/torchquantum">
</a>
Expand Down
7 changes: 7 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
furo @ git+https://github.com/frogcjn/torchquantum-doc-furo-theme.git
nbsphinx
recommonmark

torchquantum>=0.1
opt_einsum
qiskit_ibm_runtime
29 changes: 29 additions & 0 deletions docs/source/api_layers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
torchquantum.layers
======================

.. currentmodule:: torchquantum.layer

Layers
---------
.. autosummary::
:toctree: generated
:template: classtemplate_controlflow.rst


QuantumModuleFromOps
TrainableOpAll
ClassicalInOpAll
FixedOpAll
TwoQAll
RandomLayer
RandomLayerAllTypes
Op1QAllLayer
RandomOp1All
Op2QAllLayer
Op2QButterflyLayer
Op2QDenseLayer
CXLayer
CXCXCXLayer
SWAPSWAPLayer
RXYZCXLayer0
QFTLayer
2 changes: 1 addition & 1 deletion docs/source/api_operators.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
torchquantum.operators
======================

.. currentmodule:: torchquantum.operators
.. currentmodule:: torchquantum.operator

Classes
---------
Expand Down
3 changes: 1 addition & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import sys
import os
sys.path.insert(0, os.path.abspath('../..'))
import furo

#import pathlib
#sys.path.insert(0, pathlib.Path(__file__).parents[2].resolve().as_posix())
Expand Down Expand Up @@ -160,4 +159,4 @@
display_gitlab = False
show_source = True
# -- Options for EPUB output
epub_show_urls = 'footnote'
epub_show_urls = 'footnote'
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
api_torchquantum
api_functional
api_operators
api_layers

.. toctree::
:maxdepth: 1
Expand Down
Loading

0 comments on commit a5de610

Please sign in to comment.