A collection of utility functions to work with PyTorch sparse tensors
Project description
Sparsity-preserving gradient utility tools for PyTorch
A collection of utility functions to work with PyTorch sparse tensors. This is work-in-progress, here be dragons.
Currenly available features with backprop include:
- Memory efficient sparse mm with batch support (workaround for https://github.com/pytorch/pytorch/issues/41128)
- Sparse triangular solver with batch support (see discussion in https://github.com/pytorch/pytorch/issues/87358)
- Generic sparse linear solver (requires a non-differentiable backbone sparse solver)
- Generic sparse linear least-squares solver (requires a non-differentiable backbone sparse linear least-squares solver)
- Wrappers around cupy sparse solvers (see discussion in https://github.com/pytorch/pytorch/issues/69538)
- Wrappers around jax sparse solvers
- Sparse multivariate normal distribution with sparse covariance and precision parameterisation, with reparameterised sampling (rsample)
Additional backbone solvers implemented in pytorch with no additional dependencies include:
- BICGSTAB (ported from pykrylov)
- CG (ported from cornellius-gp/linear_operator)
- LSMR (ported from pytorch-minimize)
- MINRES (ported from cornellius-gp/linear_operator)
Additional features:
- Pairwise voxel encoder for encoding local neighbourhood relationships in a 3D spatial volume with multiple channels, into a sparse COO or CSR matrix.
Things that are missing may be listed as issues.
Installation
The provided package can be installed using:
pip install torchsparsegradutils
(TODO)
or
pip install git+https://github.com/cai4cai/torchsparsegradutils
Unit Tests
A number of unittests are provided, which can be run as:
python -m pytest
(Note that this also runs the tests from unittest
)
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
File details
Details for the file torchsparsegradutils-0.1.0.tar.gz
.
File metadata
- Download URL: torchsparsegradutils-0.1.0.tar.gz
- Upload date:
- Size: 67.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 880df5c6646e323c6a6b63c1bd0c2829c3ce0afdaf3e10d04210ad13da25c8e0 |
|
MD5 | 64ccd5b14685dbda6cc3d44fdb855245 |
|
BLAKE2b-256 | a0d47a7efce16579c3d969efe21b17a89781818c76174c99658f40f504f53f6f |
File details
Details for the file torchsparsegradutils-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: torchsparsegradutils-0.1.0-py3-none-any.whl
- Upload date:
- Size: 84.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 655acfbebdd5b5fd7743ff44ea36718a056aad8cc9a650df184b44fc1e6e39ed |
|
MD5 | 9a6e9e7002ddabe3c425405320c8a532 |
|
BLAKE2b-256 | fc969b8a99a5d26b67a4547d1b8937e89b06a7d26ec382b762b486c052070432 |