SqueezeExcitation¶
- class torchvision.ops.SqueezeExcitation(input_channels: int, squeeze_channels: int, activation: ~typing.Callable[[...], ~torch.nn.modules.module.Module] = <class 'torch.nn.modules.activation.ReLU'>, scale_activation: ~typing.Callable[[...], ~torch.nn.modules.module.Module] = <class 'torch.nn.modules.activation.Sigmoid'>)[source]¶
This block implements the Squeeze-and-Excitation block from https://arxiv.org/abs/1709.01507 (see Fig. 1). Parameters
activation
, andscale_activation
correspond todelta
andsigma
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: Tensor) Tensor [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.