neuralop.layers.spherical_convolution.SphericalConv

class neuralop.layers.spherical_convolution.SphericalConv(in_channels, out_channels, n_modes, max_n_modes=None, bias=True, separable=False, resolution_scaling_factor: int | float | List[float | int] | None = None, fno_block_precision='full', rank=0.5, factorization='cp', implementation='reconstructed', fixed_rank_modes=False, joint_factorization=False, decomposition_kwargs={}, init_std='auto', sht_norm='ortho', sht_grids='equiangular', device=None, dtype=torch.float32, complex_data=False)[source]

Spherical Convolution, base class for the SFNO [1]

Parameters:
sht_normstr, {‘ortho’}
sht_gridsstr or str list, default is “equiangular”, {“equiangular”, “legendre-gauss”}
  • If str, the same grid is used for all layers

  • If list, should have n_layers + 1 values, corresponding to the input and output grid of each layer e.g. for 1 layer, [“input_grid”, “output_grid”]

See SpectralConv for full list of other parameters
Attributes:
n_modes

Methods

forward(x[, output_shape])

Generic forward pass for the Factorized Spectral Conv

transform(x[, output_shape])

Transforms an input x for a skip connection, by default just an identity map

References

[1]

Spherical Fourier Neural Operators: Learning Stable Dynamics on the Sphere, Boris Bonev, Thorsten Kurth, Christian Hundt, Jaideep Pathak, Maximilian Baust, Karthik Kashinath, Anima Anandkumar, ICML 2023.

transform(x, output_shape=None)[source]

Transforms an input x for a skip connection, by default just an identity map

If your function transforms the input then you should also implement this transform method so the skip connection can also work.

Typical usecases are:

  • Your upsample or downsample the input in the Spectral conv: the skip connection has to be similarly scaled. This allows you to deal with it however you want (e.g. avoid aliasing)

  • You perform a change of basis in your Spectral Conv, again, this needs to be applied to the skip connection too.

forward(x, output_shape=None)[source]

Generic forward pass for the Factorized Spectral Conv

Parameters:
xtorch.Tensor

input activation of size (batch_size, channels, d1, …, dN)

Returns:
tensorized_spectral_conv(x)