Skip to main content

Logo

Decoupling

Fast tensor decoupling in Jax.

Tensor decoupling is a methodology for decoupling multivariate functions using tensor decompositions.

import jax, jax.numpy as jnp
from decoupling import Algorithm
from decoupling.utils import collect_information_from_random, function_error

def target(x): # define a simple polynomial
    return jnp.array([x[0]**3 + x[1]**2 + x[0]*x[1], x[1]**3 + x[0]**2 + x[0]*x[1]])

key = jax.random.key(0)
rank = 4; niters = 50; dof = 10

# collect information (inputs, outputs, jacobians)
info = collect_information_from_random(target, N=100, key=key, ninputs=2)

decoupling = Algorithm(rank, niters, dof, key).run(*info) # compute decoupling
print(function_error(target, decoupling, info[0])) # compare to target

This project was built using uv (https://docs.astral.sh/uv).

Installation

You can easily get decoupling from PyPI:

pip install decoupling

Otherwise, for a local installation:

git clone git@github.com:mrochk/decoupling.git
pip install decoupling

Methodology

Tensor decoupling algorithms are used to find a decoupled representation of a target multivariate function. This is illustrated below.

In fact, this representation is a 2-layer MLP, meaning that tensor decoupling could be used to compress or build neural networks.

You can read about the basic methodology in this paper: https://arxiv.org/abs/1410.4060.

The goal of this library is to be the reference implementation of tensor decoupling algorithms. Our goal is to keep the source code as simple as possible, while being fast by leveraging Jax's JIT compiler, and, later, GPUs.

The other important aspect is that it should be easy to design and add new algorithms, by leveraging already written and reusable code.

Testing

uv run python -m pytest -s # or ./test.sh

Metadata

Release files for decoupling 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for decoupling 0.0.8
File Size Uploaded Provenance
decoupling-0.0.8.tar.gz 11.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for decoupling 0.0.8
File Interpreter ABI Platform
decoupling-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 24.5 kB

Release files / decoupling-0.0.8.tar.gz

Download URL decoupling-0.0.8.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4db0fd485445166f293f128f616ef2902aa95c07534ddf012ac61f289a2ec0bd
BLAKE2b-256 checksum
How to use checksums
c56cbfcafdc6d20cab1ae0a1cc216397600bd1df1c76044e38aa4084c1781b1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"11","id":"bullseye","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / decoupling-0.0.8-py3-none-any.whl

Download URL decoupling-0.0.8-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
140c29d8984dd5c0d5337dd0de756aa656ece210c8bbcc0d4b77c9bed61a588c
BLAKE2b-256 checksum
How to use checksums
826f2290125183e6e15e90defd9316835e74c6ab2f0593c2ea1b362a4ae59738
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"11","id":"bullseye","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for decoupling 0.0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page