class_docstr: This class implements the `MobileViT architecture <https://arxiv.org/abs/2110.02178?context=cs.LG>`_
class_docstr_tok: ["This","class","implements","the","`","MobileViT","architecture","<","https",":","\/\/arxiv.org\/abs\/2110.02178","?","context=cs.LG",">","`","_"]
code: def _make_mobilenet_layer(
      input_channel: int, cfg: Dict
  ) -> Tuple[nn.Sequential, int]:
      output_channels = cfg.get("out_channels")
      num_blocks = cfg.get("num_blocks", 2)
      expand_ratio = cfg.get("expand_ratio", 4)
      block = []
  
      for i in range(num_blocks):
          stride = cfg.get("stride", 1) if i == 0 else 1
  
          layer = InvertedResidual(
              in_channels=input_channel,
              out_channels=output_channels,
              stride=stride,
              expand_ratio=expand_ratio,
          )
          block.append(layer)
          input_channel = output_channels
  
      return nn.Sequential(*block), input_channel
  
imports: from typing import Optional, Tuple, Union, Dict
  import math
  import torch
  import torch.nn
  from torch import Tensor
  from torch.nn import functional
  from transformer import TransformerEncoder
  from model_config import get_config
label_desc: Use image node_id 3 for calling the MobileViT obj's underlying member method code with example usage: obj._make_mobilenet_layer(input_channel, cfg) and returns: nn,  input_channel