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_activationcorrespond todeltaandsigmain 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) –
deltaactivation. Default:torch.nn.ReLUscale_activation (Callable[..., torch.nn.Module]) –
sigmaactivation. Default:torch.nn.Sigmoid
- forward(input: Tensor) Tensor[source]¶
Define 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.