code: def __init__(
      self,
      kernel_size: int,
      input_c: int,
      out_c: int,
      expand_ratio: int,
      stride: int,
      se_ratio: float = 0.25,
      drop_rate: float = 0.0,
      name: str = None,
  ):
      super(MBConv, self).__init__(name=name)
  
      if stride not in [1, 2]:
          raise ValueError("illegal stride value.")
  
      self.has_shortcut = stride == 1 and input_c == out_c
      expanded_c = input_c * expand_ratio
  
      bid = itertools.count(0)
      get_norm_name = lambda: "batch_normalization" + (
          "" if not next(bid) else "_" + str(next(bid) // 2)
      )
      cid = itertools.count(0)
      get_conv_name = lambda: "conv2d" + (
          "" if not next(cid) else "_" + str(next(cid) // 2)
      )
  
      # 在EfficientNetV2中，MBConv中不存在expansion=1的情况所以conv_pw肯定存在
      assert expand_ratio != 1
      # Point-wise expansion
      self.expand_conv = layers.Conv2D(
          filters=expanded_c,
          kernel_size=1,
          strides=1,
          padding="same",
          use_bias=False,
          name=get_conv_name(),
      )
      self.norm0 = layers.BatchNormalization(
          axis=-1, momentum=0.9, epsilon=1e-3, name=get_norm_name()
      )
      self.act0 = layers.Activation("swish")
  
      # Depth-wise convolution
      self.depthwise_conv = layers.DepthwiseConv2D(
          kernel_size=kernel_size,
          strides=stride,
          depthwise_initializer=CONV_KERNEL_INITIALIZER,
          padding="same",
          use_bias=False,
          name="depthwise_conv2d",
      )
      self.norm1 = layers.BatchNormalization(
          axis=-1, momentum=0.9, epsilon=1e-3, name=get_norm_name()
      )
      self.act1 = layers.Activation("swish")
  
      # SE
      num_reduced_filters = max(1, int(input_c * se_ratio))
      self.se = SE(num_reduced_filters, expanded_c, name="se")
  
      # Point-wise linear projection
      self.project_conv = layers.Conv2D(
          filters=out_c,
          kernel_size=1,
          strides=1,
          kernel_initializer=CONV_KERNEL_INITIALIZER,
          padding="same",
          use_bias=False,
          name=get_conv_name(),
      )
      self.norm2 = layers.BatchNormalization(
          axis=-1, momentum=0.9, epsilon=1e-3, name=get_norm_name()
      )
  
      self.drop_rate = drop_rate
      if self.has_shortcut and drop_rate > 0:
          # Stochastic Depth
          self.drop_path = layers.Dropout(
              rate=drop_rate,
              noise_shape=(None, 1, 1, 1),  # binary dropout mask
              name="drop_path",
          )
  
imports: import itertools
  import tensorflow
  from tensorflow.keras import layers, Model, Input
label_desc: Use image node_id 1 to create a new MBConv object from inherited base classes: layers with example: obj = MBConv(kernel_size, input_c, out_c, expand_ratio, stride, se_ratio, drop_rate, name)