class_docstr: Efficient Squeeze-Excitation (SE). The Squeeze-Excitation block is described in:
      *Hu et al., Squeeze-and-Excitation Networks, arXiv:1709.01507*
  This implementation has the same instantiation interface as SE implementation in
  fvcore, and in original mode for training it is just a wrapped version of SE in
  fvcore. Since conv3d in original SE implementation of fvcore is not well supported
  by QNNPACK, here convert() method is implemented which converts class instance into
  a equivalent efficient deployable form.
  
  convert_flag variable is to record whether the SqueezeExcitation instance
  has been converted; SqueezeExcitation is in original form if convert_flag is false,
  while it is in deployable form if convert_flag is true.
class_docstr_tok: ["Efficient","Squeeze-Excitation","(","SE",")",".","The","Squeeze-Excitation","block","is","described","in",":","*","Hu","et","al.",",","Squeeze-and-Excitation","Networks",",","arXiv:1709.01507","*","This","implementation","has","the","same","instantiation","interface","as","SE","implementation","in","fvcore",",","and","in","original","mode","for","training","it","is","just","a","wrapped","version","of","SE","in","fvcore",".","Since","conv3d","in","original","SE","implementation","of","fvcore","is","not","well","supported","by","QNNPACK",",","here","convert","(",")","method","is","implemented","which","converts","class","instance","into","a","equivalent","efficient","deployable","form",".","convert_flag","variable","is","to","record","whether","the","SqueezeExcitation","instance","has","been","converted",";","SqueezeExcitation","is","in","original","form","if","convert_flag","is","false",",","while","it","is","in","deployable","form","if","convert_flag","is","true","."]
docstr: Args:
      num_channels (int): Number of input channels.
      num_channels_reduced (int):
          Number of reduced channels. If none, uses reduction_ratio to calculate.
      reduction_ratio (float):
          How much num_channels should be reduced if num_channels_reduced is not provided.
      is_3d (bool): Whether we're operating on 3d data (or 2d), default 2d.
      activation (nn.Module): Activation function used, defaults to ReLU.
docstr_tok: ["Args",":","num_channels","(","int",")",":","Number","of","input","channels",".","num_channels_reduced","(","int",")",":","Number","of","reduced","channels",".","If","none",",","uses","reduction_ratio","to","calculate",".","reduction_ratio","(","float",")",":","How","much","num_channels","should","be","reduced","if","num_channels_reduced","is","not","provided",".","is_3d","(","bool",")",":","Whether","we","'re","operating","on","3d","data","(","or","2d",")",",","default","2d",".","activation","(","nn.Module",")",":","Activation","function","used",",","defaults","to","ReLU","."]
code: def __init__(
      self,
      num_channels: int,
      num_channels_reduced: Optional[int] = None,
      reduction_ratio: float = 2.0,
      is_3d: bool = False,
      activation: Optional[nn.Module] = None,
  ) -> None:
      """
      Args:
          num_channels (int): Number of input channels.
          num_channels_reduced (int):
              Number of reduced channels. If none, uses reduction_ratio to calculate.
          reduction_ratio (float):
              How much num_channels should be reduced if num_channels_reduced is not provided.
          is_3d (bool): Whether we're operating on 3d data (or 2d), default 2d.
          activation (nn.Module): Activation function used, defaults to ReLU.
      """
      super().__init__()
      # Implement SE from FVCore here for training.
      self.se = SqueezeExcitationFVCore(
          num_channels,
          num_channels_reduced=num_channels_reduced,
          reduction_ratio=reduction_ratio,
          is_3d=is_3d,
          activation=activation,
      )
      self.is_3d = is_3d
      self.convert_flag = False
  
file_path: pytorchvideo/pytorchvideo/layers/accelerator/mobile_cpu/attention.py
imports: from copy import deepcopy
  from typing import Optional
  import torch
  import torch.nn
  from fvcore.nn.squeeze_excitation import SqueezeExcitation
  from pytorchvideo.accelerator.efficient_blocks.efficient_block_base import EfficientBlockBase
  from .conv_helper import _Reshape, _SkipConnectMul
label_desc: Use image node_id 1 to create a new SqueezeExcitation object from inherited base classes: EfficientBlockBase with example: obj = SqueezeExcitation(num_channels, num_channels_reduced, reduction_ratio, is_3d, activation)