Skip to content

About

Notes and Code in Tensor Network course

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

237 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tensor Network Notes

This repo contains my notes and code related to the course Tensor Network.

Environment Setup

This is a uv project using Python 3.14 or newer. Setting up the environment is easy:

  1. If you have not got uv installed, follow the instructions to install it.
  2. Run uv sync to create an environment and get dependencies, including development dependencies that you need to run the code in a notebook.

The dependencies were refreshed to stable releases on 2026-10-30, including PyTorch 2.15.0, TorchVision 0.29.2, MLX 0.32.4, and nbdev 3.3.27. Use uv sync --locked --all-extras to reproduce the locked environment, including the optional MLX dependency. For a deliberate dependency refresh, run uv lock --upgrade followed by uv sync --locked --all-extras. The resolver retains the transitive dependency mpmath at 1.3.0 because SymPy requires <1.4; its newer stable release is incompatible with that constraint.

Run Tools

We use poe to run tools. Available commands are:

  • lab: run Jupyter Lab
  • sync: export notebook code to the tensor_network package with nbdev-export
  • format: format the code in notebooks
  • Checking: use ruff linter to check code
    • check_tensor_network: check the exported code in tensor_network package
    • check: check code in .
    • check_all: check code in . and tensor_network
  • precommit: run pre-commit hooks

Ruff uses the E4, E7, E9, and F lint rules, with the exceptions configured in pyproject.toml.

Sample usage:

# if your shell detects venvs automatically, you can run poe directly
poe lab
# if your shell does not detect venvs automatically, you can run uv run poe directly
uv run poe lab

Trained MPS Checkpoints

See the repo on Huggingface.

Contribution

Contributions are very welcome. Please file an issue or PR if you have any questions or suggestions.

A few points to note:

  • The code should primarily live in notebooks, not Python scripts. We use nbdev 3 to export useful code from notebooks to the tensor_network package for reusability. After editing notebook source, run uv run poe sync to regenerate the Python modules and symbol index. Keep notebook cell IDs, which nbdev uses to map exported code back to its source cells.
  • Run pre-commit install, or uv run pre-commit install if your shell doesn't autodetect venv

Project metadata and dependencies live in pyproject.toml, with notebook paths and export settings in [tool.nbdev]. This replaces the legacy settings.ini, setup.py, and MANIFEST.in files. Hatch remains the package build backend.

The package version is defined in tensor_network/__init__.py, which both nbdev and Hatch read. To increment it, run uv run nbdev-bump-version, then uv sync --locked to refresh the installed package metadata. uv tracks the version file when deciding whether to rebuild the package.

Acknowledgements

  • Big thanks to Prof. Ran for the course
  • Thanks to Gemini 2.0 and Claude Sonnet for transcribing a lot of equations

About

Notes and Code in Tensor Network course

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages