code: def __init__(
      self,
      cnf: InvertedResidualConfig,
      norm_layer: Callable[..., nn.Module],
  ):
      super(InvertedResidual, self).__init__()
  
      if cnf.stride not in [1, 2]:
          raise ValueError("illegal stride value.")
  
      self.use_res_connect = (
          cnf.stride == 1 and cnf.input_c == cnf.out_c
      )
  
      layers: List[nn.Module] = []
      activation_layer = nn.Hardswish if cnf.use_hs else nn.ReLU
  
      # expand
      if cnf.expanded_c != cnf.input_c:
          layers.append(
              ConvBNActivation(
                  cnf.input_c,
                  cnf.expanded_c,
                  kernel_size=1,
                  norm_layer=norm_layer,
                  activation_layer=activation_layer,
              )
          )
  
      # depthwise
      stride = 1 if cnf.dilation > 1 else cnf.stride
      layers.append(
          ConvBNActivation(
              cnf.expanded_c,
              cnf.expanded_c,
              kernel_size=cnf.kernel,
              stride=stride,
              dilation=cnf.dilation,
              groups=cnf.expanded_c,
              norm_layer=norm_layer,
              activation_layer=activation_layer,
          )
      )
  
      if cnf.use_se:
          layers.append(SqueezeExcitation(cnf.expanded_c))
  
      # project
      layers.append(
          ConvBNActivation(
              cnf.expanded_c,
              cnf.out_c,
              kernel_size=1,
              norm_layer=norm_layer,
              activation_layer=nn.Identity,
          )
      )
  
      self.block = nn.Sequential(*layers)
      self.out_channels = cnf.out_c
      self.is_strided = cnf.stride > 1
  
imports: from typing import Callable, List, Optional
  import torch
  from torch import nn, Tensor
  from torch.nn import functional
  from functools import partial
label_desc: Use image node_id 1 to create a new InvertedResidual object from inherited base classes: nn with example: obj = InvertedResidual(cnf, norm_layer)