class_docstr: This class implements the `MobileViT architecture <https://arxiv.org/abs/2110.02178?context=cs.LG>`_
code: def __init__(self, opts, *args, **kwargs) -> None:
      num_classes = getattr(
          opts, "model.classification.n_classes", 1000
      )
      classifier_dropout = getattr(
          opts, "model.classification.classifier_dropout", 0.0
      )
  
      pool_type = getattr(opts, "model.layer.global_pool", "mean")
      image_channels = 3
      out_channels = 16
  
      mobilevit_config = get_configuration(opts=opts)
  
      super().__init__(opts, *args, **kwargs)
  
      # store model configuration in a dictionary
      self.model_conf_dict = dict()
      self.conv_1 = ConvLayer2d(
          opts=opts,
          in_channels=image_channels,
          out_channels=out_channels,
          kernel_size=3,
          stride=2,
          use_norm=True,
          use_act=True,
      )
  
      self.model_conf_dict["conv1"] = {
          "in": image_channels,
          "out": out_channels,
      }
  
      in_channels = out_channels
      self.layer_1, out_channels = self._make_layer(
          opts=opts,
          input_channel=in_channels,
          cfg=mobilevit_config["layer1"],
      )
      self.model_conf_dict["layer1"] = {
          "in": in_channels,
          "out": out_channels,
      }
  
      in_channels = out_channels
      self.layer_2, out_channels = self._make_layer(
          opts=opts,
          input_channel=in_channels,
          cfg=mobilevit_config["layer2"],
      )
      self.model_conf_dict["layer2"] = {
          "in": in_channels,
          "out": out_channels,
      }
  
      in_channels = out_channels
      self.layer_3, out_channels = self._make_layer(
          opts=opts,
          input_channel=in_channels,
          cfg=mobilevit_config["layer3"],
      )
      self.model_conf_dict["layer3"] = {
          "in": in_channels,
          "out": out_channels,
      }
  
      in_channels = out_channels
      self.layer_4, out_channels = self._make_layer(
          opts=opts,
          input_channel=in_channels,
          cfg=mobilevit_config["layer4"],
          dilate=self.dilate_l4,
      )
      self.model_conf_dict["layer4"] = {
          "in": in_channels,
          "out": out_channels,
      }
  
      in_channels = out_channels
      self.layer_5, out_channels = self._make_layer(
          opts=opts,
          input_channel=in_channels,
          cfg=mobilevit_config["layer5"],
          dilate=self.dilate_l5,
      )
      self.model_conf_dict["layer5"] = {
          "in": in_channels,
          "out": out_channels,
      }
  
      in_channels = out_channels
      exp_channels = min(
          mobilevit_config["last_layer_exp_factor"] * in_channels, 960
      )
      self.conv_1x1_exp = ConvLayer2d(
          opts=opts,
          in_channels=in_channels,
          out_channels=exp_channels,
          kernel_size=1,
          stride=1,
          use_act=True,
          use_norm=True,
      )
  
      self.model_conf_dict["exp_before_cls"] = {
          "in": in_channels,
          "out": exp_channels,
      }
  
      self.classifier = nn.Sequential()
      self.classifier.add_module(
          name="global_pool",
          module=GlobalPool(pool_type=pool_type, keep_dim=False),
      )
      if 0.0 < classifier_dropout < 1.0:
          self.classifier.add_module(
              name="dropout",
              module=Dropout(p=classifier_dropout, inplace=True),
          )
      self.classifier.add_module(
          name="fc",
          module=LinearLayer(
              in_features=exp_channels,
              out_features=num_classes,
              bias=True,
          ),
      )
  
      # check model
      self.check_model()
  
      # weight initialization
      self.reset_parameters(opts=opts)
  
file_path: ml-cvnets/cvnets/models/classification/mobilevit.py
imports: import argparse
  from typing import Dict, Optional, Tuple
  from torch import nn
  from cvnets.layers import ConvLayer2d, Dropout, GlobalPool, LinearLayer
  from cvnets.models import MODEL_REGISTRY
  from cvnets.models.classification.base_image_encoder import BaseImageEncoder
  from cvnets.models.classification.config.mobilevit import get_configuration
  from cvnets.modules import InvertedResidual, MobileViTBlock
  from utils import logger
label_desc: Use image node_id 1 to create a new MobileViT object from inherited base classes: BaseImageEncoder with example: obj = MobileViT(opts)