class_docstr: This class defines the `MobileViTv2 <https://arxiv.org/abs/2206.02680>`_ architecture
code: def _make_mit_layer(
      self,
      opts,
      input_channel,
      cfg: Dict,
      dilate: Optional[bool] = False,
  ) -> Tuple[nn.Sequential, int]:
      prev_dilation = self.dilation
      block = []
      stride = cfg.get("stride", 1)
  
      if stride == 2:
          if dilate:
              self.dilation *= 2
              stride = 1
  
          layer = InvertedResidual(
              opts=opts,
              in_channels=input_channel,
              out_channels=cfg.get("out_channels"),
              stride=stride,
              expand_ratio=cfg.get("mv_expand_ratio", 4),
              dilation=prev_dilation,
          )
  
          block.append(layer)
          input_channel = cfg.get("out_channels")
  
      attn_unit_dim = cfg["attn_unit_dim"]
      ffn_multiplier = cfg.get("ffn_multiplier")
  
      dropout = getattr(opts, "model.classification.mitv2.dropout", 0.0)
  
      block.append(
          Block(
              opts=opts,
              in_channels=input_channel,
              attn_unit_dim=attn_unit_dim,
              ffn_multiplier=ffn_multiplier,
              n_attn_blocks=cfg.get("attn_blocks", 1),
              patch_h=cfg.get("patch_h", 2),
              patch_w=cfg.get("patch_w", 2),
              dropout=dropout,
              ffn_dropout=getattr(
                  opts, "model.classification.mitv2.ffn_dropout", 0.0
              ),
              attn_dropout=getattr(
                  opts, "model.classification.mitv2.attn_dropout", 0.0
              ),
              conv_ksize=3,
              attn_norm_layer=getattr(
                  opts,
                  "model.classification.mitv2.attn_norm_layer",
                  "layer_norm_2d",
              ),
              dilation=self.dilation,
          )
      )
  
      return nn.Sequential(*block), input_channel
  
file_path: ml-cvnets/cvnets/models/classification/mobilevit_v2.py
imports: import argparse
  from typing import Dict, Optional, Tuple
  from torch import nn
  from cvnets.layers import ConvLayer2d, GlobalPool, Identity, LinearLayer
  from cvnets.models import MODEL_REGISTRY
  from cvnets.models.classification.base_image_encoder import BaseImageEncoder
  from cvnets.models.classification.config.mobilevit_v2 import get_configuration
  from cvnets.modules import InvertedResidual
  from cvnets.modules import MobileViTBlockv2
label_desc: Use image node_id 5 for calling the MobileViTv2 obj's underlying member method code with example usage: obj._make_mit_layer(opts, input_channel, cfg, dilate) and returns: nn,  input_channel