xnn.cnn.fast.spherical#
Fast path of the SphericalCNN correlations (Triton kernels).
The reference layers transform with zero-padded spectra (b, 2b - 1, 2b - 1):
the band of each FFT axis is cut out and pasted back with cat and zero fills,
the contractions over beta and the spectral products are einsums over the
padded entries (most of them zero) with layout copies around them. Here the
spectra are compact and blocked by degree (see
spherical_kernels): the forward contraction reads the FFT
output at the band positions and writes the blocks, and the inverse contraction
writes the whole FFT grid of the inverse transform (zeros off the band included),
both as Triton kernels. A block of degree l is the matrix of that degree’s
spectral product as a view, so the product is one complex matrix product per
degree with the filter spectrum, (B (2l + 1), C_in (2l + 1)) @ (C_in (2l + 1),
C_out (2l + 1)) for an SO(3) input and (B (2l + 1), C_in) @ (C_in, C_out (2l
+ 1)) for an S^2 one, whose result is the block of the output spectrum. The
FFTs, the filter spectra (a small matrix product of the filter values with the
basis) and everything outside the correlations stay as in the reference.
The contractions are linear and adjoint to each other, so each one’s backward is
the other kernel and differentiable again; autograd differentiates the matrix
products, keeping views of the compact spectra. Force training runs through the
fused layers. The parameters and the state_dict are the reference ones.
Module Attributes
Edge counts above which |
|
The same for training mode (a step with a force loss, second derivatives included). |
|
Batches (atoms) up to which float32 evaluation runs the correlations on padded blocks. |
Functions
|
The degree-blocked spectra of grid signals: the fast counterpart of |
|
The output of an |
|
The filter spectra |
|
The conjugated filter spectra |
|
The spectral product of a correlation: a complex matrix product per degree. |
|
Triton kernels on a CUDA device in float32 or float64. |
|
The real grid signals of degree-blocked spectra: the fast counterpart of |