class_docstr: Reparameterizable token mixer
  
  For more details, please refer to our paper:
  `FastViT: A Fast Hybrid Vision Transformer using Structural Reparameterization`
  
  Args:
      opts: Command line arguments.
      dim: Input feature map dimension. :math:`C_{in}` from an expected input of size :math:`(B, C_{in}, H, W)`.
      kernel_size: Kernel size for spatial mixing. Default: 3
      use_layer_scale: If True, learnable layer scale is used. Default: ``True``
      layer_scale_init_value: Initial value for layer scale. Default: 1e-5
      inference_mode: If True, instantiates model in inference mode. Default: ``False``
class_docstr_tok: ["Reparameterizable","token","mixer","For","more","details",",","please","refer","to","our","paper",":","`","FastViT",":","A","Fast","Hybrid","Vision","Transformer","using","Structural","Reparameterization","`","Args",":","opts",":","Command","line","arguments",".","dim",":","Input","feature","map","dimension",".",":","math",":","`","C_","{","in","}","`","from","an","expected","input","of","size",":","math",":","`","(","B",",","C_","{","in","}",",","H",",","W",")","`",".","kernel_size",":","Kernel","size","for","spatial","mixing",".","Default",":","3","use_layer_scale",":","If","True",",","learnable","layer","scale","is","used",".","Default",":","``","True","``","layer_scale_init_value",":","Initial","value","for","layer","scale",".","Default",":","1e-5","inference_mode",":","If","True",",","instantiates","model","in","inference","mode",".","Default",":","``","False","``"]
code: def __init__(
      self,
      opts: argparse.Namespace,
      dim: int,
      kernel_size: int = 3,
      use_layer_scale: bool = True,
      layer_scale_init_value: float = 1e-5,
      inference_mode: bool = False,
  ):
      super().__init__()
      self.dim = dim
      self.kernel_size = kernel_size
  
      if inference_mode:
          self.reparam_conv = nn.Conv2d(
              in_channels=self.dim,
              out_channels=self.dim,
              kernel_size=self.kernel_size,
              stride=1,
              padding=self.kernel_size // 2,
              groups=self.dim,
              bias=True,
          )
      else:
          self.norm = MobileOneBlock(
              opts,
              dim,
              dim,
              kernel_size,
              padding=kernel_size // 2,
              groups=dim,
              use_act=False,
              use_scale_branch=False,
              num_conv_branches=0,
          )
          self.mixer = MobileOneBlock(
              opts,
              dim,
              dim,
              kernel_size,
              padding=kernel_size // 2,
              groups=dim,
              use_act=False,
          )
          self.use_layer_scale = use_layer_scale
          if use_layer_scale:
              self.layer_scale = nn.Parameter(
                  layer_scale_init_value * torch.ones((dim, 1, 1)),
              )
  
imports: import argparse
  from typing import Optional, Tuple, Union
  import torch
  import torch.nn
  from cvnets.layers import ConvLayer2d, MultiHeadAttention, StochasticDepth
  from cvnets.layers.normalization.batch_norm import BatchNorm2d
  from cvnets.modules import BaseModule
  from cvnets.modules.mobileone_block import MobileOneBlock, RepLKBlock
label_desc: Use image node_id 1 to create a new RepMixer object from inherited base classes: BaseModule with example: obj = RepMixer(opts, dim, kernel_size, use_layer_scale, layer_scale_init_value, inference_mode)