neuralop.layers.differential_conv.FiniteDifferenceConvolution

class neuralop.layers.differential_conv.FiniteDifferenceConvolution(in_channels, out_channels, n_dim, kernel_size=3, groups=1, padding='periodic')[source]

Finite Difference Convolution Layer introduced in [1]. “Neural Operators with Localized Integral and Differential Kernels” (ICML 2024)

Computes a finite difference convolution on a regular grid, which converges to a directional derivative as the grid is refined.

Parameters:
in_channelsint

number of in_channels

out_channelsint

number of out_channels

n_dimint

number of dimensions in the input domain

kernel_sizeint

odd kernel size used for convolutional finite difference stencil

groupsint

splitting number of channels

paddingliteral {‘periodic’, ‘replicate’, ‘reflect’, ‘zeros’}

mode of padding to use on input. See torch.nn.functional.padding.

Methods

forward(x, grid_width)

FiniteDifferenceConvolution's forward pass.

References

[1]

: Liu-Schiaffini, M., et al. (2024). “Neural Operators with Localized Integral and Differential Kernels”. ICML 2024, https://arxiv.org/abs/2402.16845.

forward(x, grid_width)[source]

FiniteDifferenceConvolution’s forward pass. Alternatively, one could center the conv kernel by subtracting the mean pointwise in the kernel: conv(x, kernel - mean(kernel)) / grid_width

Parameters:
xtorch.tensor

input tensor, shape (batch, in_channels, d_1, d_2, …d_n)

grid_widthfloat

discretization size of input grid