A flexible linear operator abstraction in pytorch.
Project description
torch-named-linops
A flexible linear operator abstraction implemented in PyTorch.
$ pip install torch-named-linops
Quick Example
import torch
from torchlinops import Dense, Diagonal, Dim
# Create operators with named dimensions
W = torch.randn(3, 7)
A = Dense(W, Dim("MN"), ishape=Dim("N"), oshape=Dim("M"))
# Apply, take adjoint, compose
x = torch.randn(7)
y = A(x) # Forward: y = W @ x
z = A.H(y) # Adjoint: z = W^H @ y
w = A.N(x) # Normal: w = W^H @ W @ x
# Compose operators with @
d = torch.randn(3)
B = Diagonal(d, ioshape=Dim("M"))
C = B @ A # Chain: C(x) = diag(d) @ W @ x
See the Getting Started guide for a full walkthrough.
Selected Feature List
- A dedicated abstraction for naming linear operator dimensions.
- A set of core linops, including:
DenseDiagonalFFTArrayToBlocks[^1] (similar to PyTorch's unfold but in 1D/2D/3D/arbitrary dimensions)- Useful for local patch extraction
Interpolate[^1] (similar to SigPy's interpolate/gridding)- Comes with
kaiser_besseland first-ordersplinekernels.
- Comes with
.Hand.Nproperties for adjoint $A^H$ and normal $A^HA$ linop creation.ChainandAddfor composing linops together.- Splitting a single linop across multiple GPUs.
- Full support for complex numbers. Adjoint takes the conjugate transpose.
- Full support for
autograd-based automatic differentiation.
[^1]: Includes a functional interface and triton backend for 1D/2D/3D.
Other Packages
This package was heavily inspired by a few other influential packages. In no particular order:
- einops: named dimensions/naming things in general.
- sigpy: the linop abstraction and the idea of having dedicated adjoint and normal properties. Also inspired the NUFFT, Interpolate, and ArrayToBlocks/BlocksToArray operators.
- torch_linops: another linop abstraction. Geared more towards optimization.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torch_named_linops-0.6.4.tar.gz.
File metadata
- Download URL: torch_named_linops-0.6.4.tar.gz
- Upload date:
- Size: 339.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01ce7ac75f7bc31e14c924a0f0579f48db9f306ddf0ffffa6f18ed8da8f7714c
|
|
| MD5 |
cb2a804f6d8257a2a63a85860e013228
|
|
| BLAKE2b-256 |
0feb51ce70918520854ec0c4e4fa3128cf47b3123f9cfc0c2ac737ddf00056b0
|
Provenance
The following attestation bundles were made for torch_named_linops-0.6.4.tar.gz:
Publisher:
release.yml on nishi951/torch-named-linops
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_named_linops-0.6.4.tar.gz -
Subject digest:
01ce7ac75f7bc31e14c924a0f0579f48db9f306ddf0ffffa6f18ed8da8f7714c - Sigstore transparency entry: 1192030338
- Sigstore integration time:
-
Permalink:
nishi951/torch-named-linops@07ac8ce7922f1c437c117f542abed8b014366a8f -
Branch / Tag:
refs/tags/0.6.4 - Owner: https://github.com/nishi951
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@07ac8ce7922f1c437c117f542abed8b014366a8f -
Trigger Event:
push
-
Statement type:
File details
Details for the file torch_named_linops-0.6.4-py3-none-any.whl.
File metadata
- Download URL: torch_named_linops-0.6.4-py3-none-any.whl
- Upload date:
- Size: 216.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
570f1606520654260fe9910da29022cdfa21bc68a3d50ec18be9ec45dbeb1815
|
|
| MD5 |
67ffc80145ef8b420045221b20ec72b6
|
|
| BLAKE2b-256 |
b7b03337fd3200d46be6c7bc04629e1940201038c92f9e74ba0154116725821c
|
Provenance
The following attestation bundles were made for torch_named_linops-0.6.4-py3-none-any.whl:
Publisher:
release.yml on nishi951/torch-named-linops
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
torch_named_linops-0.6.4-py3-none-any.whl -
Subject digest:
570f1606520654260fe9910da29022cdfa21bc68a3d50ec18be9ec45dbeb1815 - Sigstore transparency entry: 1192030341
- Sigstore integration time:
-
Permalink:
nishi951/torch-named-linops@07ac8ce7922f1c437c117f542abed8b014366a8f -
Branch / Tag:
refs/tags/0.6.4 - Owner: https://github.com/nishi951
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@07ac8ce7922f1c437c117f542abed8b014366a8f -
Trigger Event:
push
-
Statement type: