fusionlab.layers.squeeze_excitation.se module#

class fusionlab.layers.squeeze_excitation.se.SEModule(input_channels, squeeze_channels, act_layer=<class 'torch.nn.modules.activation.ReLU'>, scale_layer=<class 'torch.nn.modules.activation.Sigmoid'>, spatial_dims=2)[source]#

Bases: Module

source: pytorch/vision This block implements the Squeeze-and-Excitation block from https://arxiv.org/abs/1709.01507 (see Fig. 1). Parameters activation, and scale_activation correspond to delta and sigma in eq. 3.

Parameters:
  • input_channels (int) – Number of channels in the input image

  • squeeze_channels (int) – Number of squeeze channels

  • activation (Callable[..., torch.nn.Module], optional) – delta activation. Default: torch.nn.ReLU

  • scale_activation (Callable[..., torch.nn.Module]) – sigma activation. Default: torch.nn.Sigmoid

forward(input)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Return type:

Tensor

training: bool#