class_docstr: Re-implementation of the Squeeze-and-Excitation block based on:
  "Hu et al., Squeeze-and-Excitation Networks, https://arxiv.org/abs/1709.01507".
class_docstr_tok: ["Re-implementation","of","the","Squeeze-and-Excitation","block","based","on",":","''","Hu","et","al.",",","Squeeze-and-Excitation","Networks",",","https",":","\/\/arxiv.org\/abs\/1709.01507","''","."]
docstr: Args:
      x: in shape (batch, in_channels, spatial_1[, spatial_2, ...]).
docstr_tok: ["Args",":","x",":","in","shape","(","batch",",","in_channels",",","spatial_1","[",",","spatial_2",",","...","]",")","."]
code: def forward(self, x: torch.Tensor) -> torch.Tensor:
      """
      Args:
          x: in shape (batch, in_channels, spatial_1[, spatial_2, ...]).
      """
      b, c = x.shape[:2]
      y: torch.Tensor = self.avg_pool(x).view(b, c)
      y = self.fc(y).view([b, c] + [1] * (x.ndim - 2))
      result = x * y
  
      # Residual connection is moved here instead of providing an override of forward in ResidualSELayer since
      # Torchscript has an issue with using super().
      if self.add_residual:
          result += x
  
      return result
  
imports: from __future__ import annotations
  import math
  import torch
  import torch.nn
  from monai.networks.blocks import Convolution
  from monai.networks.layers.factories import Act, Conv, Norm, Pool, split_args
label_desc: Use image node_id 2 for calling the ChannelSELayer obj's underlying member method code with example usage: obj.forward(x) and returns: result