class_docstr: Reparameterizable token mixer.
  
  For more details, please refer to our paper:
  `FastViT: A Fast Hybrid Vision Transformer using Structural Reparameterization <https://arxiv.org/pdf/2303.14189.pdf>`_
class_docstr_tok: ["Reparameterizable","token","mixer",".","For","more","details",",","please","refer","to","our","paper",":","`","FastViT",":","A","Fast","Hybrid","Vision","Transformer","using","Structural","Reparameterization","<","https",":","\/\/arxiv.org\/pdf\/2303.14189.pdf",">","`","_"]
docstr: Build RepMixer Module.
  
  Args:
      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,
      dim,
      kernel_size=3,
      use_layer_scale=True,
      layer_scale_init_value=1e-5,
      inference_mode: bool = False,
  ):
      """Build RepMixer Module.
  
      Args:
          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``
      """
      super().__init__()
      self.dim = dim
      self.kernel_size = kernel_size
      self.inference_mode = inference_mode
  
      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(
              dim,
              dim,
              kernel_size,
              padding=kernel_size // 2,
              groups=dim,
              use_act=False,
              use_scale_branch=False,
              num_conv_branches=0,
          )
          self.mixer = MobileOneBlock(
              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)),
                  requires_grad=True,
              )
  
imports: import os
  import copy
  from functools import partial
  from typing import List, Tuple, Optional, Union
  import torch
  import torch.nn
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.models.layers import DropPath, trunc_normal_
  from timm.models.registry import register_model
  from models.modules.mobileone import MobileOneBlock
  from models.modules.replknet import ReparamLargeKernelConv
label_desc: Use image node_id 1 to create a new RepMixer object from inherited base classes: nn with example: obj = RepMixer(dim, kernel_size, use_layer_scale, layer_scale_init_value, inference_mode)