class_docstr: 2D Squeeze and excitation layer, as per https://arxiv.org/pdf/1709.01507.pdf
docstr: Args:
      in_planes (int): input channel dimension.
      reduction_ratio (int): factor by which in_planes should be reduced to
          get the output channel dimension.
      reduced_planes (int): Output channel dimension. Only one of reduction_ratio
          or reduced_planes should be defined.
docstr_tok: ["Args",":","in_planes","(","int",")",":","input","channel","dimension",".","reduction_ratio","(","int",")",":","factor","by","which","in_planes","should","be","reduced","to","get","the","output","channel","dimension",".","reduced_planes","(","int",")",":","Output","channel","dimension",".","Only","one","of","reduction_ratio","or","reduced_planes","should","be","defined","."]
code: def __init__(
      self,
      in_planes: int,
      reduction_ratio: Optional[int] = 16,
      reduced_planes: Optional[int] = None,
  ):
      """
      Args:
          in_planes (int): input channel dimension.
          reduction_ratio (int): factor by which in_planes should be reduced to
              get the output channel dimension.
          reduced_planes (int): Output channel dimension. Only one of reduction_ratio
              or reduced_planes should be defined.
      """
      super().__init__()
      self.avgpool = nn.AdaptiveAvgPool2d((1, 1))
  
      # Either reduction_ratio is defined, or out_planes is defined
      assert bool(reduction_ratio) != bool(
          reduced_planes
      ), "Only of reduction_ratio or reduced_planes should be defined for SE layer"
  
      reduced_planes = (
          in_planes // reduction_ratio
          if reduced_planes is None
          else reduced_planes
      )
      self.excitation = nn.Sequential(
          nn.Conv2d(
              in_planes,
              reduced_planes,
              kernel_size=1,
              stride=1,
              bias=True,
          ),
          nn.ReLU(),
          nn.Conv2d(
              reduced_planes,
              in_planes,
              kernel_size=1,
              stride=1,
              bias=True,
          ),
          nn.Sigmoid(),
      )
  
file_path: pytorchvideo/pytorchvideo/layers/squeeze_excitation.py
imports: from typing import Callable, Optional
  import torch
  import torch.nn
  from pytorchvideo.models.resnet import ResBlock
label_desc: Use image node_id 1 to create a new SqueezeAndExcitationLayer2D object from inherited base classes: nn with example: obj = SqueezeAndExcitationLayer2D(in_planes, reduction_ratio, reduced_planes)