Skip to content

Commit a5de610

Browse files
authored
Merge pull request #197 from mit-han-lab/dev
Major release v0.1.8
2 parents ea63947 + 497320c commit a5de610

File tree

154 files changed

+33371
-17464
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+33371
-17464
lines changed
+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v3
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
29+
python -m pip install flake8 pytest qiskit-aer qiskit_ibm_runtime
30+
- name: Lint with flake8
31+
run: |
32+
# stop the build if there are Python syntax errors or undefined names
33+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
34+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
35+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
36+
- name: Test with pytest
37+
run: |
38+
python -m pytest -m "not skip"
39+
- name: Install TorchQuantum
40+
run: |
41+
pip install --editable .
42+
- name: Test Examples
43+
run: |
44+
python3 examples/qubit_rotation/qubit_rotation.py --epochs 1
45+
python3 examples/vqe/vqe.py --epochs 1 --steps_per_epoch 1
46+
python3 examples/train_unitary_prep/train_unitary_prep.py --epochs 1
47+
python3 examples/train_state_prep/train_state_prep.py --epochs 1
48+
python3 examples/superdense_coding/superdense_coding_torchquantum.py
49+
python3 examples/regression/run_regression.py --epochs 1
50+
python3 examples/param_shift_onchip_training/param_shift.py
51+
python3 examples/mnist/mnist_2qubit_4class.py --epochs 1
52+
python3 examples/hadamard_grad/circ.py
53+
python3 examples/encoder_examples/encoder_8x2ry.py
54+
python3 examples/converter_tq_qiskit/convert.py
55+
python3 examples/amplitude_encoding_mnist/mnist_new.py --epochs 1
56+
python3 examples/amplitude_encoding_mnist/mnist_example.py --epochs 1
57+
python3 examples/PauliSumOp/pauli_sum_op.py
58+
python3 examples/regression/new_run_regression.py --epochs 1
59+
python3 examples/quanvolution/quanvolution_trainable_quantum_layer.py --epochs 1
60+
python3 examples/grover/grover_example_sudoku.py
61+
python3 examples/param_shift_onchip_training/param_shift.py
62+
python3 examples/quanvolution/quanvolution.py --epochs 1
63+
python3 examples/quantum_lstm/qlstm.py --epochs 1
64+
python3 examples/qaoa/max_cut_backprop.py --steps 1
65+
python3 examples/optimal_control/optimal_control.py --epochs 1
66+
python3 examples/optimal_control/optimal_control_gaussian.py --epochs 1
67+
python3 examples/optimal_control/optimal_control_multi_qubit.py --epochs 1
68+
python3 examples/save_load_example/save_load.py
69+
python3 examples/mnist/mnist.py --epochs 1

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88

99
<p align="center">
10-
<a href="https://github.com/mit-han-lab/torchquantum/blob/master/LICENSE">
11-
<img alt="MIT License" src="https://img.shields.io/github/license/mit-han-lab/torchquantum">
12-
</a>
1310
<a href="https://torchquantum.readthedocs.io/">
1411
<img alt="Documentation" src="https://img.shields.io/readthedocs/torchquantum/main">
1512
</a>
13+
<a href="https://github.com/mit-han-lab/torchquantum/blob/master/LICENSE">
14+
<img alt="MIT License" src="https://img.shields.io/github/license/mit-han-lab/torchquantum">
15+
</a>
1616
<a href="https://join.slack.com/t/torchquantum/shared_invite/zt-1ghuf283a-OtP4mCPJREd~367VX~TaQQ">
1717
<img alt="Chat @ Slack" src="https://img.shields.io/badge/slack-chat-2eb67d.svg?logo=slack">
1818
</a>
@@ -25,7 +25,6 @@
2525
<a href="https://qmlsys.mit.edu">
2626
<img alt="Website" src="https://img.shields.io/website?up_message=qmlsys&url=https%3A%2F%2Fqmlsys.mit.edu">
2727
</a>
28-
2928
<a href="https://pypi.org/project/torchquantum/">
3029
<img alt="Pypi" src="https://img.shields.io/pypi/v/torchquantum">
3130
</a>

docs/requirements.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
furo @ git+https://github.com/frogcjn/torchquantum-doc-furo-theme.git
2+
nbsphinx
3+
recommonmark
4+
5+
torchquantum>=0.1
6+
opt_einsum
7+
qiskit_ibm_runtime

docs/source/api_layers.rst

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
torchquantum.layers
2+
======================
3+
4+
.. currentmodule:: torchquantum.layer
5+
6+
Layers
7+
---------
8+
.. autosummary::
9+
:toctree: generated
10+
:template: classtemplate_controlflow.rst
11+
12+
13+
QuantumModuleFromOps
14+
TrainableOpAll
15+
ClassicalInOpAll
16+
FixedOpAll
17+
TwoQAll
18+
RandomLayer
19+
RandomLayerAllTypes
20+
Op1QAllLayer
21+
RandomOp1All
22+
Op2QAllLayer
23+
Op2QButterflyLayer
24+
Op2QDenseLayer
25+
CXLayer
26+
CXCXCXLayer
27+
SWAPSWAPLayer
28+
RXYZCXLayer0
29+
QFTLayer

docs/source/api_operators.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
torchquantum.operators
22
======================
33

4-
.. currentmodule:: torchquantum.operators
4+
.. currentmodule:: torchquantum.operator
55

66
Classes
77
---------

docs/source/conf.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import sys
3030
import os
3131
sys.path.insert(0, os.path.abspath('../..'))
32-
import furo
3332

3433
#import pathlib
3534
#sys.path.insert(0, pathlib.Path(__file__).parents[2].resolve().as_posix())
@@ -160,4 +159,4 @@
160159
display_gitlab = False
161160
show_source = True
162161
# -- Options for EPUB output
163-
epub_show_urls = 'footnote'
162+
epub_show_urls = 'footnote'

docs/source/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
api_torchquantum
66
api_functional
77
api_operators
8+
api_layers
89

910
.. toctree::
1011
:maxdepth: 1

0 commit comments

Comments
 (0)