mr2.nn.attention.SqueezeExcitation

class mr2.nn.attention.SqueezeExcitation[source]

Bases: Module

Squeeze-and-Excitation block.

Sequeeze-and-Excitation block from [SE].

References

..[SE] Hu, Jie, Li Shen, and Gang Sun. “Squeeze-and-excitation networks.” CVPR 2018, https://arxiv.org/abs/1709.01507

__init__(n_dim: int, n_channels_input: int, n_channels_squeeze: int) → None[source]

Initialize SqueezeExcitation.

Parameters:
  • n_dim (int) – The dimension of the input tensor.

  • n_channels_input (int) – The number of channels in the input tensor.

  • n_channels_squeeze (int) – The number of channels in the squeeze tensor.

__call__(x: Tensor) → Tensor[source]

Apply SqueezeExcitation.

Parameters:

x (Tensor) – The input tensor.

Returns:

The output tensor.

forward(x: Tensor) → Tensor[source]

Apply SqueezeExcitation.