class_docstr: Mobile Inverted Residual Bottleneck Block.
class_docstr_tok: ["Mobile","Inverted","Residual","Bottleneck","Block","."]
code: def __init__(
      self,
      input_filters: int,
      output_filters: int,
      expand_ratio: float,
      kernel_size: int,
      stride: int,
      se_ratio: float,
      id_skip: bool,
      use_se: bool,
      bn_momentum: float,
      bn_epsilon: float,
  ):
      assert se_ratio is None or (0 < se_ratio <= 1)
      super().__init__()
      self.bn_momentum = bn_momentum
      self.bn_epsilon = bn_epsilon
      self.has_se = use_se and se_ratio is not None
      self.se_avgpool = nn.AdaptiveAvgPool2d((1, 1))
      self.id_skip = id_skip
      self.expand_ratio = expand_ratio
      self.stride = stride
      self.input_filters = input_filters
      self.output_filters = output_filters
  
      self.relu_fn = (
          swish if get_torch_version() < [1, 7] else nn.SiLU()
      )
  
      # used to track the depth of the block
      self.depth = 0
  
      # Expansion phase
      expanded_filters = input_filters * expand_ratio
      if expand_ratio != 1:
          self.expand_conv = nn.Conv2d(
              in_channels=input_filters,
              out_channels=expanded_filters,
              kernel_size=1,
              stride=1,
              padding=0,
              bias=False,
          )
          self.bn0 = nn.BatchNorm2d(
              num_features=expanded_filters,
              momentum=self.bn_momentum,
              eps=self.bn_epsilon,
          )
          self.depth += 1
  
      # Depthwise convolution phase
      self.depthwise_conv = nn.Conv2d(
          in_channels=expanded_filters,
          out_channels=expanded_filters,
          groups=expanded_filters,
          kernel_size=kernel_size,
          stride=stride,
          padding=get_same_padding_for_kernel_size(kernel_size),
          bias=False,
      )
      self.bn1 = nn.BatchNorm2d(
          num_features=expanded_filters,
          momentum=self.bn_momentum,
          eps=self.bn_epsilon,
      )
      self.depth += 1
  
      if self.has_se:
          # Squeeze and Excitation layer
          num_reduced_filters = max(1, int(input_filters * se_ratio))
          self.se_reduce = nn.Conv2d(
              in_channels=expanded_filters,
              out_channels=num_reduced_filters,
              kernel_size=1,
              stride=1,
              padding=0,
              bias=True,
          )
          self.se_expand = nn.Conv2d(
              in_channels=num_reduced_filters,
              out_channels=expanded_filters,
              kernel_size=1,
              stride=1,
              padding=0,
              bias=True,
          )
          self.depth += 2
  
      # Output phase
      self.project_conv = nn.Conv2d(
          in_channels=expanded_filters,
          out_channels=output_filters,
          kernel_size=1,
          stride=1,
          padding=0,
          bias=False,
      )
      self.bn2 = nn.BatchNorm2d(
          num_features=output_filters,
          momentum=self.bn_momentum,
          eps=self.bn_epsilon,
      )
      self.depth += 1
  
imports: import copy
  import math
  from collections import OrderedDict
  from typing import Any, Dict, NamedTuple, Optional
  import torch
  import torch.nn
  from classy_vision.generic.util import get_torch_version
  from classy_vision.models import ClassyModel, register_model
label_desc: Use image node_id 1 to create a new MBConvBlock object from inherited base classes: nn with example: obj = MBConvBlock(input_filters, output_filters, expand_ratio, kernel_size, stride, se_ratio, id_skip, use_se, bn_momentum, bn_epsilon)