Shortcuts

SqueezeExcitation

class torchvision.ops.SqueezeExcitation(input_channels: int, squeeze_channels: int, activation: Callable[[...], torch.nn.modules.module.Module] = <class 'torch.nn.modules.activation.ReLU'>, scale_activation: 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, and scale_activation correspond to delta and sigma in 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: torch.Tensor)torch.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.

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources