v0.1.0
Release Notes:
We are excited to announce the first release of TorchSparseGradUtils, a suite of efficient utilities that extend the functionality of PyTorch sparse tensor operations to support sparse gradient back-propagation from sparse input tensors.
Here are the key features included in this release:
PyTorch Matrix operations with sparse gradients support:
- Sparse-Dense matrix multiplication with batch support sparse_matmul.
- Sparse-Dense triangular linear solver with batch support sparse_triangular_solve
- Sparse-Dense generic linear solver sparse_generic_solve
Sparse Gaussian Distribution:
- SparseMultivariateNormal Distribution parameterised by either a sparse lower triangular covariance or precision matrix with reparameterised sampling
Sparse Encoder:
- PairwiseVoxelEncoder to encode sparse matrices with relationships between pairs of voxels in local neighbourshoods of 3D volumetric images.
Sparse utilities:
- Convert COO indices and values to CSR indices and values with convert_coo_to_csr_indices_values, with batch support.
- Convert COO sparse tensors to CSR sparse tensors with batched support with convert_coo_to_csr
- Equivalent of torch.block_diag() for sparse COO and CSR matrices sparse_block_diag and a function to perform the reverse sparse_block_diag_split
- Equivalent of torch.eye for sparse COO and CSR matrices sparse_eye
- Equivalent of torch.stack() for sparse CSR tensors stack_csr
Generating Random Sparse Matrices:
- Equivalent of torch.rand() for sparse COO and CSR matrices rand_sparse
- rand_sparse_tri used for generating random strictly triangular sparse matrices in either COO or CSR format.
Additional backbone solvers implemented in pure PyTorch:
- BICGSTAB (ported from pykrylov) bicstab
- CG (ported from cornellius-gp/linear_operator) linear_cg
- LSMR (ported from pytorch-minimize) lsmr
- MINRES (ported from cornellius-gp/linear_operator) minres
CuPy and JAX solvers:
We also provide wrappers around cupy sparse solvers and jax sparse solvers. Allowing linear systems of PyTorch sparse matrices to be solved using a CuPy or JAX back-end:
- Sparse-Dense linear solver with CuPy back-end sparse_solve_c4t
- Sparse-Dense linear solver with JAX back-end sparse_solve_j4t
Installation:
This version can be installed using:
pip install torchsparsegradutils==0.1.0
We welcome any feedback, suggestions, and contributions via our issues page.
For more details about this release, you can refer to the Full Changelog.