List of Spectral Convolutions
All spectral convolutions perform the same computation for a signal of different dimensions.
Formula
Using the notation from Li et al. [40], the spectral convolution is defined by
Note that these functions do not construct \(R\), allowing them to be used in both the deterministic and Bayesian cases.
Spectral Conv 1d
The function spectral_conv1d() is imported using the following command:
>>> from UQpy.scientific_machine_learning.functional import spectral_conv1d
- spectral_conv1d(x, weights, out_channels, modes)[source]
Compute the 1d spectral convolution \(\mathcal{F}^{-1}(R (\mathcal{F}x) )\)
- Parameters:
x (
Tensor) – Tensor of shape \((N, C_\text{in}, L)\)weights (
Tensor) – Tensor of shape \((C_\text{in}, C_\text{out}, \text{modes})\). Weight tensor must have complex entries.out_channels (
int) – \(C_\text{out}\), Number of channels in the output signalmodes (
int) – Number of Fourier modes to keep, at most \(\lfloor L / 2 \rfloor + 1\)
- Return type:
Tensor- Returns:
Tensor \(\mathcal{F}^{-1}(R (\mathcal{F}x) )\) of shape \((N, C_\text{out}, L)\)
Spectral Conv 2d
The function spectral_conv2d() is imported using the following command:
>>> from UQpy.scientific_machine_learning.functional import spectral_conv2d
- spectral_conv2d(x, weights, out_channels, modes)[source]
Compute the 2d spectral convolution \(\mathcal{F}^{-1}(R (\mathcal{F}x) )\)
- Parameters:
x (
Tensor) – Tensor of shape \((N, C_\text{in}, H, W)\)weights (
Tensor) – Tensors of shape \((2, C_\text{in}, C_\text{out}, \text{modes[0]}, \text{modes[1]})\). Tensors must have complex entries.out_channels (
int) – \(C_\text{out}\), Number of channels in the output signalmodes (
tuple[int,int]) – Tuple of Fourier modes to keep. At most \((\lfloor H / 2 \rfloor + 1, \lfloor W / 2 \rfloor + 1)\)
- Return type:
Tensor- Returns:
Tensor \(\mathcal{F}^{-1}(R (\mathcal{F}x) )\) of shape \((N, C_\text{out}, H, W)\)
Spectral Conv 3d
The function spectral_conv3d() is imported using the following command:
>>> from UQpy.scientific_machine_learning.functional import spectral_conv3d
- spectral_conv3d(x, weights, out_channels, modes)[source]
Compute the 3d spectral convolution \(\mathcal{F}^{-1}(R (\mathcal{F}x) )\)
- Parameters:
x (
Tensor) – Tensor of shape \((N, C_\text{in}, D, H, W)\)weights (
Tensor) – Tensor of shape \((4, C_\text{in}, C_\text{out}, \text{modes[0]}, \text{modes[1]}, \text{modes[2]})\). Must have complex entries.modes (
tuple[int,int,int]) – Tuple of Fourier modes to keep. At most \((\lfloor D / 2 \rfloor + 1, \lfloor H / 2 \rfloor + 1, \lfloor W / 2 \rfloor + 1)\)out_channels (
int) – \(C_\text{out}\), Number of channels in the output signal
- Return type:
Tensor- Returns:
Tensor \(\mathcal{F}^{-1}(R (\mathcal{F}x) )\) of shape \((N, C_\text{out}, D, H, W)\)