code: def block(
      inputs,
      activation: str = "swish",
      drop_rate: float = 0.0,
      name: str = "",
      input_channel: int = 32,
      output_channel: int = 16,
      kernel_size: int = 3,
      strides: int = 1,
      expand_ratio: int = 1,
      use_se: bool = True,
      se_ratio: float = 0.25,
  ):
      """An inverted residual block.
  
      Arguments:
          inputs: input tensor.
          activation: activation function.
          drop_rate: float between 0 and 1, fraction of the input units to drop.
          name: string, block label.
          input_channel: integer, the number of input filters.
          output_channel: integer, the number of output filters.
          kernel_size: integer, the dimension of the convolution window.
          strides: integer, the stride of the convolution.
          expand_ratio: integer, scaling coefficient for the input filters.
          use_se: whether to use se
          se_ratio: float between 0 and 1, fraction to squeeze the input filters.
  
      Returns:
          output tensor for the block.
      """
      # Expansion phase
      filters = input_channel * expand_ratio
      if expand_ratio != 1:
          x = layers.Conv2D(
              filters=filters,
              kernel_size=1,
              padding="same",
              use_bias=False,
              kernel_initializer=CONV_KERNEL_INITIALIZER,
              name=name + "expand_conv",
          )(inputs)
          x = layers.BatchNormalization(name=name + "expand_bn")(x)
          x = layers.Activation(
              activation, name=name + "expand_activation"
          )(x)
      else:
          x = inputs
  
      # Depthwise Convolution
      if strides == 2:
          x = layers.ZeroPadding2D(
              padding=correct_pad(filters, kernel_size),
              name=name + "dwconv_pad",
          )(x)
  
      x = layers.DepthwiseConv2D(
          kernel_size=kernel_size,
          strides=strides,
          padding="same" if strides == 1 else "valid",
          use_bias=False,
          depthwise_initializer=CONV_KERNEL_INITIALIZER,
          name=name + "dwconv",
      )(x)
      x = layers.BatchNormalization(name=name + "bn")(x)
      x = layers.Activation(activation, name=name + "activation")(x)
  
      if use_se:
          filters_se = int(input_channel * se_ratio)
          se = layers.GlobalAveragePooling2D(name=name + "se_squeeze")(
              x
          )
          se = layers.Reshape(
              (1, 1, filters), name=name + "se_reshape"
          )(se)
          se = layers.Conv2D(
              filters=filters_se,
              kernel_size=1,
              padding="same",
              activation=activation,
              kernel_initializer=CONV_KERNEL_INITIALIZER,
              name=name + "se_reduce",
          )(se)
          se = layers.Conv2D(
              filters=filters,
              kernel_size=1,
              padding="same",
              activation="sigmoid",
              kernel_initializer=CONV_KERNEL_INITIALIZER,
              name=name + "se_expand",
          )(se)
          x = layers.multiply([x, se], name=name + "se_excite")
  
      # Output phase
      x = layers.Conv2D(
          filters=output_channel,
          kernel_size=1,
          padding="same",
          use_bias=False,
          kernel_initializer=CONV_KERNEL_INITIALIZER,
          name=name + "project_conv",
      )(x)
      x = layers.BatchNormalization(name=name + "project_bn")(x)
      if strides == 1 and input_channel == output_channel:
          if drop_rate > 0:
              x = layers.Dropout(
                  rate=drop_rate,
                  noise_shape=(None, 1, 1, 1),  # binary dropout mask
                  name=name + "drop",
              )(x)
          x = layers.add([x, inputs], name=name + "add")
  
      return x
  
file_path: deep-learning-for-image-processing/tensorflow_classification/Test9_efficientNet/model.py
imports: import math
  from typing import Union
  from tensorflow.keras import layers, Model
label_desc: Use image node_id 2 for calling a global function with example usage: block(inputs, activation, drop_rate, name, input_channel, output_channel, kernel_size, strides, expand_ratio, use_se, se_ratio) and returns: x