torch-harmonics#
Differentiable signal processing on the sphere for PyTorch.
torch-harmonics implements differentiable spherical harmonic transforms (SHT),
discrete-continuous (DISCO) convolutions, spherical attention, and related
operators as PyTorch modules. All operators are autograd-compatible and run on
CPU and GPU, with optional custom CUDA kernels for the performance-critical
paths.
Getting started
- Installation
- Benchmarking
- Tutorials
- Getting started with
torch-harmonics - Visualizing the spherical harmonics
- Quadrature
- Polar and azimuthal derivatives
- Analyzing the gradients of the SHT
- Helmholtz equation
- Differentiable shallow water equations
- Spherical Fourier neural operators
- Stanford 2D-3D-S dataset
- Filter basis functions
- Resampling signals on the 2-sphere
- Conditioning of the SHT
- Spherical attention equivariance test
- Getting started with
User guide
Quick example#
import torch
import torch_harmonics as th
# forward / inverse real spherical harmonic transform on an equiangular grid
sht = th.RealSHT(nlat=128, nlon=256, grid="equiangular")
isht = th.InverseRealSHT(nlat=128, nlon=256, grid="equiangular")
signal = torch.randn(1, 128, 256)
coeffs = sht(signal) # -> spherical harmonic coefficients
reconstructed = isht(coeffs) # -> back to grid space
Bibliography