code: def __init__(
      self,
      cnf: InvertedResidualConfig,
      norm_layer: Callable[..., nn.Module],
      se_layer: Callable[..., nn.Module] = partial(
          SElayer, scale_activation=nn.Hardsigmoid
      ),
  ):
      super().__init__()
      if not (1 <= cnf.stride <= 2):
          raise ValueError("illegal stride value")
  
      self.use_res_connect = (
          cnf.stride == 1 and cnf.input_channels == cnf.out_channels
      )
  
      layers: List[nn.Module] = []
      activation_layer = nn.Hardswish if cnf.use_hs else nn.ReLU
  
      # expand
      if cnf.expanded_channels != cnf.input_channels:
          layers.append(
              Conv2dNormActivation(
                  cnf.input_channels,
                  cnf.expanded_channels,
                  kernel_size=1,
                  norm_layer=norm_layer,
                  activation_layer=activation_layer,
              )
          )
  
      # depthwise
      stride = 1 if cnf.dilation > 1 else cnf.stride
      layers.append(
          Conv2dNormActivation(
              cnf.expanded_channels,
              cnf.expanded_channels,
              kernel_size=cnf.kernel,
              stride=stride,
              dilation=cnf.dilation,
              groups=cnf.expanded_channels,
              norm_layer=norm_layer,
              activation_layer=activation_layer,
          )
      )
      if cnf.use_se:
          squeeze_channels = _make_divisible(
              cnf.expanded_channels // 4, 8
          )
          layers.append(
              se_layer(cnf.expanded_channels, squeeze_channels)
          )
  
      # project
      layers.append(
          Conv2dNormActivation(
              cnf.expanded_channels,
              cnf.out_channels,
              kernel_size=1,
              norm_layer=norm_layer,
              activation_layer=None,
          )
      )
  
      self.block = nn.Sequential(*layers)
      self.out_channels = cnf.out_channels
      self._is_cn = cnf.stride > 1
  
imports: from functools import partial
  from typing import Any, Callable, List, Optional, Sequence
  import torch
  from torch import nn, Tensor
  from ..ops.misc import Conv2dNormActivation, SqueezeExcitation
  from ..transforms._presets import ImageClassification
  from ..utils import _log_api_usage_once
  from ._api import register_model, Weights, WeightsEnum
  from ._meta import _IMAGENET_CATEGORIES
  from ._utils import _make_divisible, _ovewrite_named_param, handle_legacy_interface
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, se_layer)