neuralop.layers.skip_connections.skip_connection

neuralop.layers.skip_connections.skip_connection(in_features, out_features, n_dim=2, bias=False, skip_type='soft-gating')[source]

A wrapper for several types of skip connections. Returns an nn.Module skip connections, one of {‘identity’, ‘linear’, soft-gating’}

Parameters:
in_featuresint

Number of input features

out_featuresint

Number of output features

n_dimint, optional

Dimensionality of the input (excluding batch-size and channels). n_dim=2 corresponds to having Module2D, by default 2

biasbool, optional

Whether to use a bias, by default False

skip_type{‘identity’, ‘linear’, ‘soft-gating’}, optional

Kind of skip connection to use. Options: ‘identity’, ‘linear’, ‘soft-gating’, by default “soft-gating”

Returns:
nn.Module

module that takes in x and returns skip(x)