class_docstr: This class defines the `MobileViT block <https://arxiv.org/abs/2110.02178?context=cs.LG>`_
  
  Args:
      opts: command line arguments
      in_channels (int): :math:`C_{in}` from an expected input of size :math:`(N, C_{in}, H, W)`
      transformer_dim (int): Input dimension to the transformer unit
      ffn_dim (int): Dimension of the FFN block
      n_transformer_blocks (int): Number of transformer blocks. Default: 2
      head_dim (int): Head dimension in the multi-head attention. Default: 32
      attn_dropout (float): Dropout in multi-head attention. Default: 0.0
      dropout (float): Dropout rate. Default: 0.0
      ffn_dropout (float): Dropout between FFN layers in transformer. Default: 0.0
      patch_h (int): Patch height for unfolding operation. Default: 8
      patch_w (int): Patch width for unfolding operation. Default: 8
      transformer_norm_layer (Optional[str]): Normalization layer in the transformer block. Default: layer_norm
      conv_ksize (int): Kernel size to learn local representations in MobileViT block. Default: 3
      no_fusion (Optional[bool]): Do not combine the input and output feature maps. Default: False
class_docstr_tok: ["This","class","defines","the","`","MobileViT","block","<","https",":","\/\/arxiv.org\/abs\/2110.02178","?","context=cs.LG",">","`","_","Args",":","opts",":","command","line","arguments","in_channels","(","int",")",":",":","math",":","`","C_","{","in","}","`","from","an","expected","input","of","size",":","math",":","`","(","N",",","C_","{","in","}",",","H",",","W",")","`","transformer_dim","(","int",")",":","Input","dimension","to","the","transformer","unit","ffn_dim","(","int",")",":","Dimension","of","the","FFN","block","n_transformer_blocks","(","int",")",":","Number","of","transformer","blocks",".","Default",":","2","head_dim","(","int",")",":","Head","dimension","in","the","multi-head","attention",".","Default",":","32","attn_dropout","(","float",")",":","Dropout","in","multi-head","attention",".","Default",":","0.0","dropout","(","float",")",":","Dropout","rate",".","Default",":","0.0","ffn_dropout","(","float",")",":","Dropout","between","FFN","layers","in","transformer",".","Default",":","0.0","patch_h","(","int",")",":","Patch","height","for","unfolding","operation",".","Default",":","8","patch_w","(","int",")",":","Patch","width","for","unfolding","operation",".","Default",":","8","transformer_norm_layer","(","Optional","[","str","]",")",":","Normalization","layer","in","the","transformer","block",".","Default",":","layer_norm","conv_ksize","(","int",")",":","Kernel","size","to","learn","local","representations","in","MobileViT","block",".","Default",":","3","no_fusion","(","Optional","[","bool","]",")",":","Do","not","combine","the","input","and","output","feature","maps",".","Default",":","False"]
code: def unfolding(self, x: Tensor) -> Tuple[Tensor, Dict]:
      patch_w, patch_h = self.patch_w, self.patch_h
      patch_area = patch_w * patch_h
      batch_size, in_channels, orig_h, orig_w = x.shape
  
      new_h = int(math.ceil(orig_h / self.patch_h) * self.patch_h)
      new_w = int(math.ceil(orig_w / self.patch_w) * self.patch_w)
  
      interpolate = False
      if new_w != orig_w or new_h != orig_h:
          # Note: Padding can be done, but then it needs to be handled in attention function.
          x = F.interpolate(
              x,
              size=(new_h, new_w),
              mode="bilinear",
              align_corners=False,
          )
          interpolate = True
  
      # number of patches along width and height
      num_patch_w = new_w // patch_w  # n_w
      num_patch_h = new_h // patch_h  # n_h
      num_patches = num_patch_h * num_patch_w  # N
  
      # [B, C, H, W] -> [B * C * n_h, p_h, n_w, p_w]
      x = x.reshape(
          batch_size * in_channels * num_patch_h,
          patch_h,
          num_patch_w,
          patch_w,
      )
      # [B * C * n_h, p_h, n_w, p_w] -> [B * C * n_h, n_w, p_h, p_w]
      x = x.transpose(1, 2)
      # [B * C * n_h, n_w, p_h, p_w] -> [B, C, N, P] where P = p_h * p_w and N = n_h * n_w
      x = x.reshape(batch_size, in_channels, num_patches, patch_area)
      # [B, C, N, P] -> [B, P, N, C]
      x = x.transpose(1, 3)
      # [B, P, N, C] -> [BP, N, C]
      x = x.reshape(batch_size * patch_area, num_patches, -1)
  
      info_dict = {
          "orig_size": (orig_h, orig_w),
          "batch_size": batch_size,
          "interpolate": interpolate,
          "total_patches": num_patches,
          "num_patches_w": num_patch_w,
          "num_patches_h": num_patch_h,
      }
  
      return x, info_dict
  
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 2 for calling the MobileViTBlock obj's underlying member method code with example usage: obj.unfolding(x) and returns: x,  info_dict