Skip to content

Commit 66deeda

Browse files
committed
Version 0.1.0
1 parent 5fe35a2 commit 66deeda

Some content is hidden

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

49 files changed

+3484
-70
lines changed

.github/workflows/build_doc.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build TensorLy-Quantum documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
- name: Install Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: 3.8
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
python -m pip install -r requirements.txt
24+
python -m pip install -r doc/requirements_doc.txt
25+
python -m pip install torch==1.10.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
26+
- name: Install package
27+
run: |
28+
python -m pip install -e .
29+
- name: Make doc
30+
run: |
31+
cd doc
32+
# python minify.py
33+
make html
34+
cd ..
35+
- name: Push docs
36+
run: |
37+
# See https://github.community/t/github-actions-bot-email-address/17204/5
38+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
39+
git config --global user.name "github-actions"
40+
git fetch origin gh-pages
41+
git checkout gh-pages
42+
git rm -r dev/*
43+
cp -r doc/build/html/* dev
44+
git add dev
45+
# If the doc is up to date, the script shouldn't fail, hence --allow-empty
46+
# Might be a cleaner way to check
47+
git commit --allow-empty -m "Deployed to GitHub Pages"
48+
git push --force origin gh-pages

.github/workflows/deploy_pypi.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy TensorLy-Quantum to Pypi
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
- name: Install Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: 3.8
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
python -m pip install -r requirements.txt
24+
python -m pip install -r doc/requirements_doc.txt
25+
python -m pip install torch==1.10.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
26+
- name: Install package
27+
run: |
28+
python -m pip install -e .
29+
pip install setuptools wheel
30+
- name: Build a binary wheel and a source tarball
31+
run: |
32+
python setup.py sdist bdist_wheel
33+
- name: Publish package to TestPyPI
34+
uses: pypa/gh-action-pypi-publish@master
35+
with:
36+
user: __token__
37+
password: ${{ secrets.TEST_PYPI_PASSWORD }}
38+
repository_url: https://test.pypi.org/legacy/
39+
- name: Publish package to PyPI
40+
uses: pypa/gh-action-pypi-publish@master
41+
with:
42+
user: __token__
43+
password: ${{ secrets.PYPI_PASSWORD }}

.github/workflows/test.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI Test TensorLy-Quantum
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up Python 3.8
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: 3.8
16+
- name: Install TensorLy dev
17+
run: |
18+
git clone https://github.com/tensorly/tensorly
19+
cd tensorly
20+
python -m pip install -e .
21+
- name: Install TensorLy-Torch
22+
run: |
23+
git clone https://github.com/tensorly/torch
24+
cd torch
25+
python -m pip install -e .
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
python -m pip install -r requirements.txt
30+
python -m pip install -r doc/requirements_doc.txt
31+
python -m pip install torch==1.10.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
32+
- name: Install package
33+
run: |
34+
python -m pip install -e .
35+
- name: Test with pytest
36+
run: |
37+
pytest -vvv tlquantum

.gitignore

+18-70
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,27 @@
22
__pycache__/
33
*.py[cod]
44
*$py.class
5+
*.DS_Store
6+
*.vscode/
57

68
# C extensions
79
*.so
10+
*.py~
11+
12+
# Pycharm
13+
.idea
14+
15+
# vim temp files
16+
*.swp
17+
18+
# Sphinx doc
19+
doc/_build/
20+
doc/source/auto_examples/
21+
doc/source/modules/generated/
822

923
# Distribution / packaging
1024
.Python
25+
env/
1126
build/
1227
develop-eggs/
1328
dist/
@@ -19,13 +34,10 @@ lib64/
1934
parts/
2035
sdist/
2136
var/
22-
wheels/
23-
pip-wheel-metadata/
24-
share/python-wheels/
2537
*.egg-info/
2638
.installed.cfg
2739
*.egg
28-
MANIFEST
40+
.pytest_cache/
2941

3042
# PyInstaller
3143
# Usually these files are written by a python script from a template
@@ -40,90 +52,26 @@ pip-delete-this-directory.txt
4052
# Unit test / coverage reports
4153
htmlcov/
4254
.tox/
43-
.nox/
4455
.coverage
4556
.coverage.*
4657
.cache
4758
nosetests.xml
4859
coverage.xml
49-
*.cover
50-
*.py,cover
60+
*,cover
5161
.hypothesis/
52-
.pytest_cache/
5362

5463
# Translations
5564
*.mo
5665
*.pot
5766

5867
# Django stuff:
5968
*.log
60-
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
63-
64-
# Flask stuff:
65-
instance/
66-
.webassets-cache
67-
68-
# Scrapy stuff:
69-
.scrapy
7069

7170
# Sphinx documentation
7271
docs/_build/
7372

7473
# PyBuilder
7574
target/
7675

77-
# Jupyter Notebook
76+
#Ipython Notebook
7877
.ipynb_checkpoints
79-
80-
# IPython
81-
profile_default/
82-
ipython_config.py
83-
84-
# pyenv
85-
.python-version
86-
87-
# pipenv
88-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91-
# install all needed dependencies.
92-
#Pipfile.lock
93-
94-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95-
__pypackages__/
96-
97-
# Celery stuff
98-
celerybeat-schedule
99-
celerybeat.pid
100-
101-
# SageMath parsed files
102-
*.sage.py
103-
104-
# Environments
105-
.env
106-
.venv
107-
env/
108-
venv/
109-
ENV/
110-
env.bak/
111-
venv.bak/
112-
113-
# Spyder project settings
114-
.spyderproject
115-
.spyproject
116-
117-
# Rope project settings
118-
.ropeproject
119-
120-
# mkdocs documentation
121-
/site
122-
123-
# mypy
124-
.mypy_cache/
125-
.dmypy.json
126-
dmypy.json
127-
128-
# Pyre type checker
129-
.pyre/

CONTRIBUTORS.rst

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Taylor Lee Patti, NVIDIA Research and Harvard University
2+
3+
Jean Kossaifi, NVIDIA Research

LICENSE

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2021, the TensorLy-Quantum developers
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.rst

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
================
2+
TensorLy_Quantum
3+
================
4+
5+
6+
TensorLy-Quantum is a Python library for Tensor-Based Quantum Machine Learning that
7+
builds on top of `TensorLy <https://github.com/tensorly/tensorly/>`_
8+
and `PyTorch <https://pytorch.org/>`_.
9+
10+
- **Website:** http://tensorly.org/quantum/
11+
- **Source-code:** https://github.com/tensorly/quantum
12+
13+
With TensorLy-Quantum, you can easily:
14+
15+
- **Create large quantum circuit**: Tensor network formalism requires up to exponentially less memory for quantum simulation than traditional vector and matrix approaches.
16+
- **Leverage tensor methods**: the state vectors are efficiently represented in factorized form as Tensor-Rings (MPS) and the operators as TT-Matrices (MPO)
17+
- **Efficient simulation**: tensorly-quantum leverages the factorized structure to efficiently perform quantum simulation without ever forming the full, dense operators and state-vectors
18+
- **Multi-Basis Encoding**: we provide multi-basis encoding out-of-the-box for scalable experimentation
19+
- **Solve hard problems**: we provide all the tools to solve the MaxCut problem for an unprecendented number of qubits / vertices
20+
21+
22+
Installing TensorLy-Quantum
23+
============================
24+
25+
Through pip
26+
-----------
27+
28+
.. code::
29+
30+
pip install tensorly-quantum
31+
32+
33+
From source
34+
-----------
35+
36+
.. code::
37+
38+
git clone https://github.com/tensorly/quantum
39+
cd quantum
40+
pip install -e .
41+

doc/Makefile

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

0 commit comments

Comments
 (0)