neuralop.layers.padding.DomainPadding

class neuralop.layers.padding.DomainPadding(domain_padding: float | list, padding_mode: Literal['symmetric', 'one-sided'] = 'symmetric', 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_modeLiteral ['symmetric', 'one-sided'], optional

whether to pad on both sides, by default 'symmetric'

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

` (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