elektronn3.modules.layers module

Neural network layers

class elektronn3.modules.layers.GatherExcite(channels, extent=0, param_gather=False, param_excite=True, reduction=16, spatial_shape=None)[source]

Bases: torch.nn.

Gather-Excite module (https://arxiv.org/abs/1810.12348),

a generalization of the Squeeze-and-Excitation module (https://arxiv.org/abs/1709.01507).

Parameters
  • channels (int) – Number of input channels (= number of output channels)

  • extent (int) – extent factor that determines how much the gather operator output is smaller than its input. The special value extent=0 activates global gathering (so the gathered information has no spatial extent).

  • param_gather (bool) – If True, the gather operator is parametrized according to https://arxiv.org/abs/1810.12348.

  • param_excite (bool) – If True, the excitation operator is parametrized according to https://arxiv.org/abs/1810.12348 (also equivalent to the original excitation operator proposed in https://arxiv.org/abs/1709.01507).

  • reduction (int) – Channel reduction rate of the parametrized excitation operator.

  • spatial_shape (Optional[Tuple[int, …]]) – Spatial shape of the module input. This needs to be specified if param_gather=0 and extent=0 (parametrized global gathering).

forward(x)[source]