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.6

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.6
File Size Uploaded Provenance
decoupling-0.0.6.tar.gz 11.4 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 24.6 kB

Release files / decoupling-0.0.6.tar.gz

Download URL decoupling-0.0.6.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
50b4cf15006762da62f6bbe05f0d12025cc016f9d60eec19f7e8d8fed7efbaff
BLAKE2b-256 checksum
How to use checksums
4ec96cdf361e8d59bdfe3e7040244d01b69c0069901375887e22a0e173649cb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","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.6-py3-none-any.whl

Download URL decoupling-0.0.6-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e3ec978415f12e3369b847f8a0b4a7d7af857e24cd6b61c75c629affe04cd3d
BLAKE2b-256 checksum
How to use checksums
4e56827ff2d379b3d55e5c7c48791d05785b21b0ca7be5d5edfd45b5ce97a983
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","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.6

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