class_docstr: MBConv block as described in: https://arxiv.org/pdf/2204.01697.pdf.
      Without downsampling:
      x ← x + Proj(SE(DWConv(Conv(Norm(x)))))
      With downsampling:
      x ← Proj(Pool2D(x)) + Proj(SE(DWConv ↓(Conv(Norm(x))))).
      Conv is a 1 X 1 convolution followed by a Batch Normalization layer and a GELU activation.
      SE is the Squeeze-Excitation layer.
      Proj is the shrink 1 X 1 convolution.
      Note: This implementation differs slightly from the original MobileNet implementation!
  Args:
      in_channels (`int`):
          Number of input channels.
      out_channels (`int`):
          Number of output channels.
      downscale (`bool`):
          If true downscale by a factor of two is performed. Default: False
      act_layer (`nn.Module`):
          Type of activation layer to be utilized. Default: nn.GELU
      norm_layer (`nn.Module`):
          Type of normalization layer to be utilized. Default: nn.BatchNorm2d
      drop_path (`float`):
          Dropout rate to be applied during training. Default 0.
class_docstr_tok: ["MBConv","block","as","described","in",":","https",":","\/\/arxiv.org\/pdf\/2204.01697.pdf",".","Without","downsampling",":","x","\u2190","x","+","Proj","(","SE","(","DWConv","(","Conv","(","Norm","(","x",")",")",")",")",")","With","downsampling",":","x","\u2190","Proj","(","Pool2D","(","x",")",")","+","Proj","(","SE","(","DWConv","\u2193","(","Conv","(","Norm","(","x",")",")",")",")",")",".","Conv","is","a","1","X","1","convolution","followed","by","a","Batch","Normalization","layer","and","a","GELU","activation",".","SE","is","the","Squeeze-Excitation","layer",".","Proj","is","the","shrink","1","X","1","convolution",".","Note",":","This","implementation","differs","slightly","from","the","original","MobileNet","implementation","!","Args",":","in_channels","(","`","int","`",")",":","Number","of","input","channels",".","out_channels","(","`","int","`",")",":","Number","of","output","channels",".","downscale","(","`","bool","`",")",":","If","true","downscale","by","a","factor","of","two","is","performed",".","Default",":","False","act_layer","(","`","nn.Module","`",")",":","Type","of","activation","layer","to","be","utilized",".","Default",":","nn.GELU","norm_layer","(","`","nn.Module","`",")",":","Type","of","normalization","layer","to","be","utilized",".","Default",":","nn.BatchNorm2d","drop_path","(","`","float","`",")",":","Dropout","rate","to","be","applied","during","training",".","Default","0","."]
docstr: Constructor method 
docstr_tok: ["Constructor","method"]
code: def __init__(
      self,
      in_channels: int,
      out_channels: int,
      downscale: bool = False,
      act_layer: Type[nn.Module] = nn.GELU,
      norm_layer: Type[nn.Module] = nn.BatchNorm2d,
      drop_path: float = 0.0,
  ) -> None:
      """Constructor method"""
      # Call super constructor
      super().__init__()
      # Save parameter
      self.drop_path_rate: float = drop_path
      # Check parameters for downscaling
      if not downscale:
          assert (
              in_channels == out_channels
          ), "If downscaling is utilized input and output channels must be equal."
      # Ignore inplace parameter if GELU is used
      if act_layer == nn.GELU:
          act_layer = gelu_ignore_parameters
      # Make main path
      self.main_path = nn.Sequential(
          norm_layer(in_channels),
          DepthwiseSeparableConv(
              in_chs=in_channels,
              out_chs=out_channels,
              stride=2 if downscale else 1,
              act_layer=act_layer,
              norm_layer=norm_layer,
              drop_path_rate=drop_path,
          ),
          SqueezeExcite(out_channels, rd_ratio=0.25),
          nn.Conv2d(
              in_channels=out_channels,
              out_channels=out_channels,
              kernel_size=(1, 1),
          ),
      )
      # Make skip path
      self.skip_path = (
          nn.Sequential(
              nn.MaxPool2d(kernel_size=(2, 2), stride=(2, 2)),
              nn.Conv2d(
                  in_channels=in_channels,
                  out_channels=out_channels,
                  kernel_size=(1, 1),
              ),
          )
          if downscale
          else nn.Identity()
      )
      self.drop_path = DropPath(self.drop_path_rate)
  
file_path: towhee/towhee/models/layers/mbconv.py
imports: from typing import Type
  import torch
  from timm.layers import SqueezeExcite
  from timm.models._efficientnet_blocks import DepthwiseSeparableConv
  from torch import nn
  from towhee.models.layers.droppath import DropPath
  from towhee.models.utils.gelu_ignore_parameters import gelu_ignore_parameters
label_desc: Use image node_id 1 to create a new MBConv object from inherited base classes: nn with example: obj = MBConv(in_channels, out_channels, downscale, act_layer, norm_layer, drop_path)