torchTT 0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- torchtt-0.1/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- torchtt-0.1/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- torchtt-0.1/.github/workflows/docs.yml +51 -0
- torchtt-0.1/.github/workflows/publish.yml +93 -0
- torchtt-0.1/.github/workflows/testing.yml +29 -0
- torchtt-0.1/.gitignore +131 -0
- torchtt-0.1/LICENSE +21 -0
- torchtt-0.1/Makefile +20 -0
- torchtt-0.1/PKG-INFO +141 -0
- torchtt-0.1/README.md +101 -0
- torchtt-0.1/conf.py +109 -0
- torchtt-0.1/cpp/BLAS.h +238 -0
- torchtt-0.1/cpp/amen_divide.h +549 -0
- torchtt-0.1/cpp/amen_solve.h +549 -0
- torchtt-0.1/cpp/compression.h +42 -0
- torchtt-0.1/cpp/cpp_ext.cpp +19 -0
- torchtt-0.1/cpp/define.h +17 -0
- torchtt-0.1/cpp/dmrg_mv.h +231 -0
- torchtt-0.1/cpp/full.h +12 -0
- torchtt-0.1/cpp/gmres.h +310 -0
- torchtt-0.1/cpp/matvecs.h +218 -0
- torchtt-0.1/cpp/ortho.h +103 -0
- torchtt-0.1/cpp/test_gmres.cpp +253 -0
- torchtt-0.1/docs/index_page.rst +8 -0
- torchtt-0.1/docs/install.rst +53 -0
- torchtt-0.1/docs/intro_page.rst +11 -0
- torchtt-0.1/docs/modules.rst +9 -0
- torchtt-0.1/docs/package-overview.rst +87 -0
- torchtt-0.1/docs/torchtt/cpp.html +114 -0
- torchtt-0.1/docs/torchtt/errors.html +206 -0
- torchtt-0.1/docs/torchtt/grad.html +345 -0
- torchtt-0.1/docs/torchtt/index.html +4293 -0
- torchtt-0.1/docs/torchtt/interpolate.html +1438 -0
- torchtt-0.1/docs/torchtt/manifold.html +420 -0
- torchtt-0.1/docs/torchtt/nn.html +321 -0
- torchtt-0.1/docs/torchtt/solvers.html +904 -0
- torchtt-0.1/docs/torchtt/torchtt.html +6664 -0
- torchtt-0.1/docs/torchtt.rst +69 -0
- torchtt-0.1/examples/automatic_differentiation.ipynb +142 -0
- torchtt-0.1/examples/automatic_differentiation.py +38 -0
- torchtt-0.1/examples/basic_linalg.ipynb +410 -0
- torchtt-0.1/examples/basic_linalg.py +131 -0
- torchtt-0.1/examples/basic_nn.ipynb +215 -0
- torchtt-0.1/examples/basic_nn.py +92 -0
- torchtt-0.1/examples/basic_tutorial.ipynb +388 -0
- torchtt-0.1/examples/basic_tutorial.py +127 -0
- torchtt-0.1/examples/cross_interpolation.ipynb +197 -0
- torchtt-0.1/examples/cross_interpolation.py +60 -0
- torchtt-0.1/examples/cuda.ipynb +280 -0
- torchtt-0.1/examples/cuda.py +108 -0
- torchtt-0.1/examples/efficient_linalg.ipynb +370 -0
- torchtt-0.1/examples/efficient_linalg.py +85 -0
- torchtt-0.1/examples/manifold.ipynb +182 -0
- torchtt-0.1/examples/manifold.py +37 -0
- torchtt-0.1/examples/mnist_nn.ipynb +206 -0
- torchtt-0.1/examples/mnist_nn.py +84 -0
- torchtt-0.1/examples/random_tt.py +23 -0
- torchtt-0.1/examples/system_solvers.ipynb +244 -0
- torchtt-0.1/examples/system_solvers.py +79 -0
- torchtt-0.1/examples/tensor_completion.py +67 -0
- torchtt-0.1/index.rst +41 -0
- torchtt-0.1/logo.png +0 -0
- torchtt-0.1/logo_small.png +0 -0
- torchtt-0.1/make.bat +35 -0
- torchtt-0.1/pyproject.toml +40 -0
- torchtt-0.1/requirements.txt +4 -0
- torchtt-0.1/setup.cfg +4 -0
- torchtt-0.1/setup.py +65 -0
- torchtt-0.1/test_amen_mult.py +22 -0
- torchtt-0.1/tests/test_ad.py +91 -0
- torchtt-0.1/tests/test_algebra_2.py +161 -0
- torchtt-0.1/tests/test_cross.py +50 -0
- torchtt-0.1/tests/test_decomposition.py +248 -0
- torchtt-0.1/tests/test_fast_products.py +134 -0
- torchtt-0.1/tests/test_linalg.py +617 -0
- torchtt-0.1/tests/test_solvers.py +65 -0
- torchtt-0.1/tests/test_utils.py +31 -0
- torchtt-0.1/torchTT.egg-info/PKG-INFO +141 -0
- torchtt-0.1/torchTT.egg-info/SOURCES.txt +112 -0
- torchtt-0.1/torchTT.egg-info/dependency_links.txt +1 -0
- torchtt-0.1/torchTT.egg-info/requires.txt +5 -0
- torchtt-0.1/torchTT.egg-info/top_level.txt +1 -0
- torchtt-0.1/torchtt/INTRO.md +66 -0
- torchtt-0.1/torchtt/__init__.py +51 -0
- torchtt-0.1/torchtt/_amen.py +487 -0
- torchtt-0.1/torchtt/_aux_ops.py +81 -0
- torchtt-0.1/torchtt/_custom_timer.py +51 -0
- torchtt-0.1/torchtt/_decomposition.py +406 -0
- torchtt-0.1/torchtt/_division.py +476 -0
- torchtt-0.1/torchtt/_dmrg.py +388 -0
- torchtt-0.1/torchtt/_extras.py +1039 -0
- torchtt-0.1/torchtt/_fast_mult.py +187 -0
- torchtt-0.1/torchtt/_iterative_solvers.py +202 -0
- torchtt-0.1/torchtt/_torchtt.py +2363 -0
- torchtt-0.1/torchtt/_tt_base.py +1613 -0
- torchtt-0.1/torchtt/cpp/BLAS.h +238 -0
- torchtt-0.1/torchtt/cpp/amen_divide.h +549 -0
- torchtt-0.1/torchtt/cpp/amen_solve.h +549 -0
- torchtt-0.1/torchtt/cpp/compression.h +42 -0
- torchtt-0.1/torchtt/cpp/cpp_ext.cpp +19 -0
- torchtt-0.1/torchtt/cpp/define.h +17 -0
- torchtt-0.1/torchtt/cpp/dmrg_mv.h +231 -0
- torchtt-0.1/torchtt/cpp/full.h +12 -0
- torchtt-0.1/torchtt/cpp/gmres.h +310 -0
- torchtt-0.1/torchtt/cpp/matvecs.h +218 -0
- torchtt-0.1/torchtt/cpp/ortho.h +103 -0
- torchtt-0.1/torchtt/cpp/test_gmres.cpp +253 -0
- torchtt-0.1/torchtt/cpp.py +23 -0
- torchtt-0.1/torchtt/errors.py +30 -0
- torchtt-0.1/torchtt/grad.py +92 -0
- torchtt-0.1/torchtt/interpolate.py +754 -0
- torchtt-0.1/torchtt/manifold.py +173 -0
- torchtt-0.1/torchtt/nn.py +84 -0
- torchtt-0.1/torchtt/solvers.py +775 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior:
|
|
15
|
+
1. Go to '...'
|
|
16
|
+
2. Click on '....'
|
|
17
|
+
3. Scroll down to '....'
|
|
18
|
+
4. See error
|
|
19
|
+
|
|
20
|
+
**Expected behavior**
|
|
21
|
+
A clear and concise description of what you expected to happen.
|
|
22
|
+
|
|
23
|
+
**Screenshots**
|
|
24
|
+
If applicable, add screenshots to help explain your problem.
|
|
25
|
+
|
|
26
|
+
**Desktop (please complete the following information):**
|
|
27
|
+
- OS: [e.g. iOS]
|
|
28
|
+
- Browser [e.g. chrome, safari]
|
|
29
|
+
- Version [e.g. 22]
|
|
30
|
+
|
|
31
|
+
**Smartphone (please complete the following information):**
|
|
32
|
+
- Device: [e.g. iPhone6]
|
|
33
|
+
- OS: [e.g. iOS8.1]
|
|
34
|
+
- Browser [e.g. stock browser, safari]
|
|
35
|
+
- Version [e.g. 22]
|
|
36
|
+
|
|
37
|
+
**Additional context**
|
|
38
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: website
|
|
2
|
+
|
|
3
|
+
# build the documentation whenever there are new commits on main
|
|
4
|
+
on:
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- main
|
|
8
|
+
# Alternative: only build for tags.
|
|
9
|
+
tags:
|
|
10
|
+
- '*'
|
|
11
|
+
|
|
12
|
+
# security: restrict permissions for CI jobs.
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
# Build the documentation and upload the static HTML files as an artifact.
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
- uses: actions/setup-python@v4
|
|
23
|
+
with:
|
|
24
|
+
python-version: '3.10'
|
|
25
|
+
|
|
26
|
+
# ADJUST THIS: install all dependencies
|
|
27
|
+
- run: pip install torch
|
|
28
|
+
- run: python setup.py install
|
|
29
|
+
- run: pip install sphinx sphinx_rtd_theme
|
|
30
|
+
# ADJUST THIS: build your documentation into docs/.
|
|
31
|
+
# We use a custom build script for pdoc itself, ideally you just run `pdoc -o docs/ ...` here.
|
|
32
|
+
- run: make html
|
|
33
|
+
|
|
34
|
+
- uses: actions/upload-pages-artifact@v1
|
|
35
|
+
with:
|
|
36
|
+
path: _build/html
|
|
37
|
+
|
|
38
|
+
# Deploy the artifact to GitHub pages.
|
|
39
|
+
# This is a separate job so that only actions/deploy-pages has the necessary permissions.
|
|
40
|
+
deploy:
|
|
41
|
+
needs: build
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
permissions:
|
|
44
|
+
pages: write
|
|
45
|
+
id-token: write
|
|
46
|
+
environment:
|
|
47
|
+
name: github-pages
|
|
48
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
49
|
+
steps:
|
|
50
|
+
- id: deployment
|
|
51
|
+
uses: actions/deploy-pages@v2
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
name: Publish torchTT to pypi
|
|
2
|
+
|
|
3
|
+
on: push
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
name: Build distribution
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
- name: Set up Python
|
|
13
|
+
uses: actions/setup-python@v5
|
|
14
|
+
with:
|
|
15
|
+
python-version: "3.x"
|
|
16
|
+
- name: Install pypa/build
|
|
17
|
+
run: >-
|
|
18
|
+
python3 -m
|
|
19
|
+
pip install
|
|
20
|
+
build
|
|
21
|
+
--user
|
|
22
|
+
- name: Build a binary wheel and a source tarball
|
|
23
|
+
run: python3 -m build --sdist
|
|
24
|
+
- name: Store the distribution packages
|
|
25
|
+
uses: actions/upload-artifact@v4
|
|
26
|
+
with:
|
|
27
|
+
name: python-package-distributions
|
|
28
|
+
path: dist/
|
|
29
|
+
|
|
30
|
+
publish-to-pypi:
|
|
31
|
+
name: >-
|
|
32
|
+
Publish to PyPI
|
|
33
|
+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
|
|
34
|
+
needs:
|
|
35
|
+
- build
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
environment:
|
|
38
|
+
name: pypi
|
|
39
|
+
url: https://pypi.org/p/torchTT # Replace <package-name> with your PyPI project name
|
|
40
|
+
permissions:
|
|
41
|
+
id-token: write # IMPORTANT: mandatory for trusted publishing
|
|
42
|
+
|
|
43
|
+
steps:
|
|
44
|
+
- name: Download all the dists
|
|
45
|
+
uses: actions/download-artifact@v4
|
|
46
|
+
with:
|
|
47
|
+
name: python-package-distributions
|
|
48
|
+
path: dist/
|
|
49
|
+
- name: Publish distribution to PyPI
|
|
50
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
51
|
+
|
|
52
|
+
github-release:
|
|
53
|
+
name: >-
|
|
54
|
+
Sign the Python distribution with Sigstore
|
|
55
|
+
and upload them to GitHub Release
|
|
56
|
+
needs:
|
|
57
|
+
- publish-to-pypi
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
|
|
60
|
+
permissions:
|
|
61
|
+
contents: write # IMPORTANT: mandatory for making GitHub Releases
|
|
62
|
+
id-token: write # IMPORTANT: mandatory for sigstore
|
|
63
|
+
|
|
64
|
+
steps:
|
|
65
|
+
- name: Download all the dists
|
|
66
|
+
uses: actions/download-artifact@v4
|
|
67
|
+
with:
|
|
68
|
+
name: python-package-distributions
|
|
69
|
+
path: dist/
|
|
70
|
+
- name: Sign the dists with Sigstore
|
|
71
|
+
uses: sigstore/gh-action-sigstore-python@v3.0.0
|
|
72
|
+
with:
|
|
73
|
+
inputs: >-
|
|
74
|
+
./dist/*.tar.gz
|
|
75
|
+
# ./dist/*.whl
|
|
76
|
+
- name: Create GitHub Release
|
|
77
|
+
env:
|
|
78
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
79
|
+
run: >-
|
|
80
|
+
gh release create
|
|
81
|
+
'${{ github.ref_name }}'
|
|
82
|
+
--repo '${{ github.repository }}'
|
|
83
|
+
--notes ""
|
|
84
|
+
- name: Upload artifact signatures to GitHub Release
|
|
85
|
+
env:
|
|
86
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
87
|
+
# Upload to GitHub Release using the `gh` CLI.
|
|
88
|
+
# `dist/` contains the built packages, and the
|
|
89
|
+
# sigstore-produced signatures and certificates.
|
|
90
|
+
run: >-
|
|
91
|
+
gh release upload
|
|
92
|
+
'${{ github.ref_name }}' dist/**
|
|
93
|
+
--repo '${{ github.repository }}'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Continuous Integration
|
|
2
|
+
on: [push]
|
|
3
|
+
jobs:
|
|
4
|
+
buildandtest:
|
|
5
|
+
strategy:
|
|
6
|
+
matrix:
|
|
7
|
+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
|
|
8
|
+
os: [ubuntu-latest, windows-latest]
|
|
9
|
+
# os: [ubuntu-latest, windows-latest, macos-latest]
|
|
10
|
+
runs-on: ${{ matrix.os }}
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- name: Set up Python all python version
|
|
14
|
+
uses: actions/setup-python@v4
|
|
15
|
+
with:
|
|
16
|
+
python-version: ${{ matrix.python-version }}
|
|
17
|
+
# architecture: x64
|
|
18
|
+
- name: Install dependencies
|
|
19
|
+
run: |
|
|
20
|
+
python -m pip install --upgrade pip
|
|
21
|
+
pip install -r requirements.txt
|
|
22
|
+
- name: Install pytorch
|
|
23
|
+
run: pip install torch torchvision torchaudio
|
|
24
|
+
- name: Show installed
|
|
25
|
+
run: pip list
|
|
26
|
+
- name: Install torchtt
|
|
27
|
+
run: python setup.py install
|
|
28
|
+
- name: Run Test
|
|
29
|
+
run: python -m pytest tests/
|
torchtt-0.1/.gitignore
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
.vscode/
|
|
30
|
+
|
|
31
|
+
# PyInstaller
|
|
32
|
+
# Usually these files are written by a python script from a template
|
|
33
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
34
|
+
*.manifest
|
|
35
|
+
*.spec
|
|
36
|
+
|
|
37
|
+
# Installer logs
|
|
38
|
+
pip-log.txt
|
|
39
|
+
pip-delete-this-directory.txt
|
|
40
|
+
|
|
41
|
+
# Unit test / coverage reports
|
|
42
|
+
htmlcov/
|
|
43
|
+
.tox/
|
|
44
|
+
.nox/
|
|
45
|
+
.coverage
|
|
46
|
+
.coverage.*
|
|
47
|
+
.cache
|
|
48
|
+
nosetests.xml
|
|
49
|
+
coverage.xml
|
|
50
|
+
*.cover
|
|
51
|
+
*.py,cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
|
|
55
|
+
# Translations
|
|
56
|
+
*.mo
|
|
57
|
+
*.pot
|
|
58
|
+
|
|
59
|
+
# Django stuff:
|
|
60
|
+
*.log
|
|
61
|
+
local_settings.py
|
|
62
|
+
db.sqlite3
|
|
63
|
+
db.sqlite3-journal
|
|
64
|
+
|
|
65
|
+
# Flask stuff:
|
|
66
|
+
instance/
|
|
67
|
+
.webassets-cache
|
|
68
|
+
|
|
69
|
+
# Scrapy stuff:
|
|
70
|
+
.scrapy
|
|
71
|
+
|
|
72
|
+
# Sphinx documentation
|
|
73
|
+
docs/_build/
|
|
74
|
+
|
|
75
|
+
# PyBuilder
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
.python-version
|
|
87
|
+
|
|
88
|
+
# pipenv
|
|
89
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
90
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
91
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
92
|
+
# install all needed dependencies.
|
|
93
|
+
#Pipfile.lock
|
|
94
|
+
|
|
95
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
96
|
+
__pypackages__/
|
|
97
|
+
|
|
98
|
+
# Celery stuff
|
|
99
|
+
celerybeat-schedule
|
|
100
|
+
celerybeat.pid
|
|
101
|
+
|
|
102
|
+
# SageMath parsed files
|
|
103
|
+
*.sage.py
|
|
104
|
+
|
|
105
|
+
# Environments
|
|
106
|
+
.env
|
|
107
|
+
.venv
|
|
108
|
+
env/
|
|
109
|
+
venv/
|
|
110
|
+
ENV/
|
|
111
|
+
env.bak/
|
|
112
|
+
venv.bak/
|
|
113
|
+
|
|
114
|
+
# Spyder project settings
|
|
115
|
+
.spyderproject
|
|
116
|
+
.spyproject
|
|
117
|
+
|
|
118
|
+
# Rope project settings
|
|
119
|
+
.ropeproject
|
|
120
|
+
|
|
121
|
+
# mkdocs documentation
|
|
122
|
+
/site
|
|
123
|
+
|
|
124
|
+
# mypy
|
|
125
|
+
.mypy_cache/
|
|
126
|
+
.dmypy.json
|
|
127
|
+
dmypy.json
|
|
128
|
+
|
|
129
|
+
# Pyre type checker
|
|
130
|
+
.pyre/
|
|
131
|
+
_build/
|
torchtt-0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 ion-g-ion
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
torchtt-0.1/Makefile
ADDED
|
@@ -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 = .
|
|
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)
|
torchtt-0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: torchTT
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Tensor-Train decomposition in pytorch.
|
|
5
|
+
Author-email: Ion Gabriel Ion <ion.ion.gabriel@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2021 ion-g-ion
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Keywords: pytorch,tensor-train decomposition
|
|
29
|
+
Classifier: Programming Language :: Python :: 3
|
|
30
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
31
|
+
Classifier: Operating System :: OS Independent
|
|
32
|
+
Requires-Python: >=3.7
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
License-File: LICENSE
|
|
35
|
+
Requires-Dist: torch>=1.7
|
|
36
|
+
Requires-Dist: numpy>=1.18
|
|
37
|
+
Requires-Dist: opt_einsum
|
|
38
|
+
Requires-Dist: scipy>=0.16
|
|
39
|
+
Requires-Dist: ninja
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<p align="center">
|
|
43
|
+
<img src="https://github.com/ion-g-ion/torchTT/blob/main/logo.png?raw=true" width="400px" >
|
|
44
|
+
</p>
|
|
45
|
+
|
|
46
|
+
# torchTT
|
|
47
|
+
Tensor-Train decomposition in `pytorch`
|
|
48
|
+
|
|
49
|
+
Tensor-Train decomposition package written in Python on top of `pytorch`. Supports GPU acceleration and automatic differentiation.
|
|
50
|
+
It also contains routines for solving linear systems in the TT format and performing adaptive cross approximation (the AMEN solver/cross interpolation is inspired form the [MATLAB TT-Toolbox](https://github.com/oseledets/TT-Toolbox)).
|
|
51
|
+
Some routines are implemented in C++ for an increased execution speed.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
### Requirements
|
|
57
|
+
Following requirements are needed:
|
|
58
|
+
|
|
59
|
+
- `python>=3.6`
|
|
60
|
+
- `torch>=1.7.0`
|
|
61
|
+
- `numpy>=1.18`
|
|
62
|
+
- [`opt_einsum`](https://pypi.org/project/opt-einsum/)
|
|
63
|
+
|
|
64
|
+
The GPU (if available) version of pytorch is recommended to be installed. Read the [official installation guide](https://pytorch.org/get-started/locally/) for further info.
|
|
65
|
+
|
|
66
|
+
### Using pip
|
|
67
|
+
You can install the package using the `pip` command:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
pip install torchTT
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The latest github version can be installed using:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
pip install git+https://github.com/ion-g-ion/torchTT
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
One can also clone the repository and manually install the package:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
git clone https://github.com/ion-g-ion/torchTT
|
|
83
|
+
cd torchTT
|
|
84
|
+
python setup.py install
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Using conda
|
|
88
|
+
|
|
89
|
+
**TODO**
|
|
90
|
+
|
|
91
|
+
## Components
|
|
92
|
+
|
|
93
|
+
The main modules/submodules that can be accessed after importing `torchtt` are briefly desctibed in the following table.
|
|
94
|
+
Detailed description can be found [here](https://ion-g-ion.github.io/torchTT/index.html).
|
|
95
|
+
|
|
96
|
+
| Component | Description |
|
|
97
|
+
| --- | --- |
|
|
98
|
+
| [`torchtt`](https://ion-g-ion.github.io/torchTT/torchtt/torchtt.html) | Basic TT class and basic linear algebra functions. |
|
|
99
|
+
| [`torchtt.solvers`](https://ion-g-ion.github.io/torchTT/torchtt/solvers.html) | Implementation of the AMEN solver. |
|
|
100
|
+
| [`torchtt.grad`](https://ion-g-ion.github.io/torchTT/torchtt/grad.html) | Wrapper for automatic differentiation. |
|
|
101
|
+
| [`torchtt.manifold`](https://ion-g-ion.github.io/torchTT/torchtt/manifold.html) | Riemannian gradient and projection onto manifolds of tensors with fixed TT rank. |
|
|
102
|
+
| [`torchtt.nn`](https://ion-g-ion.github.io/torchTT/torchtt/nn.html) | Basic TT neural network layer. |
|
|
103
|
+
| [`torchtt.interpolate`](https://ion-g-ion.github.io/torchTT/torchtt/interpolate.html) | Cross approximation routines. |
|
|
104
|
+
|
|
105
|
+
## Tests
|
|
106
|
+
|
|
107
|
+
The directory [tests/](tests/) from the root folder contains all the `unittests`. To run them use the command:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
pytest tests/
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## Documentation and examples
|
|
115
|
+
The documentation can be found [here](https://ion-g-ion.github.io/torchTT/index.html).
|
|
116
|
+
Following example scripts (as well as python notebooks) are also provied provided as part of the documentation:
|
|
117
|
+
|
|
118
|
+
* [basic_tutorial.py](examples/basic_tutorial.py) / [basic_tutorial.ipynp](examples/basic_tutorial.ipynb): This contains a basic tutorial on decomposing full tensors in the TT format as well as performing rank rounding, slicing ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/basic_tutorial.ipynb)).
|
|
119
|
+
* [basic_linalg.py](examples/basic_linalg.py) / [basic_linalg.ipynp](examples/basic_linalg.ipynb): This tutorial presents all the algebra operations that can be performed in the TT format ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/basic_linalg.ipynb)).
|
|
120
|
+
* [efficient_linalg.py](examples/efficient_linalg.py) / [efficient_linalg.ipynb](examples/efficient_linalg.ipynb): contains the DMRG for fast matves and AMEN for elementwise inversion in the TT format ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/efficient_linalg.ipynb)).
|
|
121
|
+
* [automatic_differentiation.py](examples/automatic_differentiation.py) / [automatic_differentiation.ipynp](examples/automatic_differentiation.ipynb): Basic tutorial on AD in `torchtt` ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/automatic_differentiation.ipynb)).
|
|
122
|
+
* [cross_interpolation.py](examples/cross_interpolation.py) / [cross_interpolation.ipynb](examples/cross_interpolation.ipynb): In this script, the cross interpolation emthod is exemplified ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/cross_interpolation.ipynb)).
|
|
123
|
+
* [system_solvers.py](examples/system_solvers.py) / [system_solvers.ipynb](examples/system_solvers.ipynb): This contains the bais ussage of the multilinear solvers ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/system_solvers.ipynb)).
|
|
124
|
+
* [cuda.py](examples/cuda.py) / [cuda.ipynb](examples/cuda.ipynb): This provides an example on how to use the GPU acceleration ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/cuda.ipynb)).
|
|
125
|
+
* [basic_nn.py](examples/basic_nn.py) / [basic_nn.ipynb](examples/basic_nn.ipynb): This provides an example on how to use the TT neural network layers ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/basic_nn.ipynb)).
|
|
126
|
+
* [mnist_nn.py](examples/mnist_nn.py) / [mnist_nn.ipynb](examples/mnist_nn.ipynb): Example of TT layers used for image classification ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/mnist_nn.ipynb)).
|
|
127
|
+
|
|
128
|
+
The documentation is generated using `shpinx` with:
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
make html
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
after installing the packages
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
pip install sphinx sphinx_rtd_theme
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Author
|
|
141
|
+
Ion Gabriel Ion, e-mail: ion.ion.gabriel@gmail.com
|
torchtt-0.1/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
|
|
2
|
+
<p align="center">
|
|
3
|
+
<img src="https://github.com/ion-g-ion/torchTT/blob/main/logo.png?raw=true" width="400px" >
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
# torchTT
|
|
7
|
+
Tensor-Train decomposition in `pytorch`
|
|
8
|
+
|
|
9
|
+
Tensor-Train decomposition package written in Python on top of `pytorch`. Supports GPU acceleration and automatic differentiation.
|
|
10
|
+
It also contains routines for solving linear systems in the TT format and performing adaptive cross approximation (the AMEN solver/cross interpolation is inspired form the [MATLAB TT-Toolbox](https://github.com/oseledets/TT-Toolbox)).
|
|
11
|
+
Some routines are implemented in C++ for an increased execution speed.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
### Requirements
|
|
17
|
+
Following requirements are needed:
|
|
18
|
+
|
|
19
|
+
- `python>=3.6`
|
|
20
|
+
- `torch>=1.7.0`
|
|
21
|
+
- `numpy>=1.18`
|
|
22
|
+
- [`opt_einsum`](https://pypi.org/project/opt-einsum/)
|
|
23
|
+
|
|
24
|
+
The GPU (if available) version of pytorch is recommended to be installed. Read the [official installation guide](https://pytorch.org/get-started/locally/) for further info.
|
|
25
|
+
|
|
26
|
+
### Using pip
|
|
27
|
+
You can install the package using the `pip` command:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
pip install torchTT
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The latest github version can be installed using:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
pip install git+https://github.com/ion-g-ion/torchTT
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
One can also clone the repository and manually install the package:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
git clone https://github.com/ion-g-ion/torchTT
|
|
43
|
+
cd torchTT
|
|
44
|
+
python setup.py install
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Using conda
|
|
48
|
+
|
|
49
|
+
**TODO**
|
|
50
|
+
|
|
51
|
+
## Components
|
|
52
|
+
|
|
53
|
+
The main modules/submodules that can be accessed after importing `torchtt` are briefly desctibed in the following table.
|
|
54
|
+
Detailed description can be found [here](https://ion-g-ion.github.io/torchTT/index.html).
|
|
55
|
+
|
|
56
|
+
| Component | Description |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| [`torchtt`](https://ion-g-ion.github.io/torchTT/torchtt/torchtt.html) | Basic TT class and basic linear algebra functions. |
|
|
59
|
+
| [`torchtt.solvers`](https://ion-g-ion.github.io/torchTT/torchtt/solvers.html) | Implementation of the AMEN solver. |
|
|
60
|
+
| [`torchtt.grad`](https://ion-g-ion.github.io/torchTT/torchtt/grad.html) | Wrapper for automatic differentiation. |
|
|
61
|
+
| [`torchtt.manifold`](https://ion-g-ion.github.io/torchTT/torchtt/manifold.html) | Riemannian gradient and projection onto manifolds of tensors with fixed TT rank. |
|
|
62
|
+
| [`torchtt.nn`](https://ion-g-ion.github.io/torchTT/torchtt/nn.html) | Basic TT neural network layer. |
|
|
63
|
+
| [`torchtt.interpolate`](https://ion-g-ion.github.io/torchTT/torchtt/interpolate.html) | Cross approximation routines. |
|
|
64
|
+
|
|
65
|
+
## Tests
|
|
66
|
+
|
|
67
|
+
The directory [tests/](tests/) from the root folder contains all the `unittests`. To run them use the command:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
pytest tests/
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
## Documentation and examples
|
|
75
|
+
The documentation can be found [here](https://ion-g-ion.github.io/torchTT/index.html).
|
|
76
|
+
Following example scripts (as well as python notebooks) are also provied provided as part of the documentation:
|
|
77
|
+
|
|
78
|
+
* [basic_tutorial.py](examples/basic_tutorial.py) / [basic_tutorial.ipynp](examples/basic_tutorial.ipynb): This contains a basic tutorial on decomposing full tensors in the TT format as well as performing rank rounding, slicing ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/basic_tutorial.ipynb)).
|
|
79
|
+
* [basic_linalg.py](examples/basic_linalg.py) / [basic_linalg.ipynp](examples/basic_linalg.ipynb): This tutorial presents all the algebra operations that can be performed in the TT format ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/basic_linalg.ipynb)).
|
|
80
|
+
* [efficient_linalg.py](examples/efficient_linalg.py) / [efficient_linalg.ipynb](examples/efficient_linalg.ipynb): contains the DMRG for fast matves and AMEN for elementwise inversion in the TT format ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/efficient_linalg.ipynb)).
|
|
81
|
+
* [automatic_differentiation.py](examples/automatic_differentiation.py) / [automatic_differentiation.ipynp](examples/automatic_differentiation.ipynb): Basic tutorial on AD in `torchtt` ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/automatic_differentiation.ipynb)).
|
|
82
|
+
* [cross_interpolation.py](examples/cross_interpolation.py) / [cross_interpolation.ipynb](examples/cross_interpolation.ipynb): In this script, the cross interpolation emthod is exemplified ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/cross_interpolation.ipynb)).
|
|
83
|
+
* [system_solvers.py](examples/system_solvers.py) / [system_solvers.ipynb](examples/system_solvers.ipynb): This contains the bais ussage of the multilinear solvers ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/system_solvers.ipynb)).
|
|
84
|
+
* [cuda.py](examples/cuda.py) / [cuda.ipynb](examples/cuda.ipynb): This provides an example on how to use the GPU acceleration ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/cuda.ipynb)).
|
|
85
|
+
* [basic_nn.py](examples/basic_nn.py) / [basic_nn.ipynb](examples/basic_nn.ipynb): This provides an example on how to use the TT neural network layers ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/basic_nn.ipynb)).
|
|
86
|
+
* [mnist_nn.py](examples/mnist_nn.py) / [mnist_nn.ipynb](examples/mnist_nn.ipynb): Example of TT layers used for image classification ([Try on Google Colab](https://colab.research.google.com/github/ion-g-ion/torchTT/blob/main/examples/mnist_nn.ipynb)).
|
|
87
|
+
|
|
88
|
+
The documentation is generated using `shpinx` with:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
make html
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
after installing the packages
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
pip install sphinx sphinx_rtd_theme
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Author
|
|
101
|
+
Ion Gabriel Ion, e-mail: ion.ion.gabriel@gmail.com
|