neuralop.layers.padding.DomainPadding

class neuralop.layers.padding.DomainPadding(domain_padding, padding_mode='one-sided', resolution_scaling_factor: int | List[int] = 1)[source]

Applies domain padding scaled automatically to the input’s resolution

Parameters:
domain_paddingfloat or list

typically, between zero and one, percentage of padding to use if a list, make sure if matches the dim of (d1, …, dN)

padding_mode{‘symmetric’, ‘one-sided’}, optional

whether to pad on both sides, by default ‘one-sided’

resolution_scaling_factorint ; default is 1

Methods

forward(x)

forward pass: pad the input

pad(x[, verbose])

Take an input and pad it by the desired fraction

unpad(x)

Remove the padding from padding inputs

Notes

This class works for any input resolution, as long as it is in the form (batch-size, channels, d1, …., dN)

forward(x)[source]

forward pass: pad the input

pad(x, verbose=False)[source]

Take an input and pad it by the desired fraction

The amount of padding will be automatically scaled with the resolution

unpad(x)[source]

Remove the padding from padding inputs