code: def __init__(
      self,
      dim,
      depth,
      kernel_size=9,
      patch_size=7,
      in_chans=3,
      num_classes=1000,
      global_pool="avg",
      drop_rate=0.0,
      act_layer=nn.GELU,
      **kwargs,
  ):
      super().__init__()
      self.num_classes = num_classes
      self.num_features = dim
      self.grad_checkpointing = False
  
      self.stem = nn.Sequential(
          nn.Conv2d(
              in_chans, dim, kernel_size=patch_size, stride=patch_size
          ),
          act_layer(),
          nn.BatchNorm2d(dim),
      )
      self.blocks = nn.Sequential(
          *[
              nn.Sequential(
                  Residual(
                      nn.Sequential(
                          nn.Conv2d(
                              dim,
                              dim,
                              kernel_size,
                              groups=dim,
                              padding="same",
                          ),
                          act_layer(),
                          nn.BatchNorm2d(dim),
                      )
                  ),
                  nn.Conv2d(dim, dim, kernel_size=1),
                  act_layer(),
                  nn.BatchNorm2d(dim),
              )
              for i in range(depth)
          ]
      )
      self.pooling = SelectAdaptivePool2d(
          pool_type=global_pool, flatten=True
      )
      self.head_drop = nn.Dropout(drop_rate)
      self.head = (
          nn.Linear(dim, num_classes)
          if num_classes > 0
          else nn.Identity()
      )
  
imports: import torch
  import torch.nn
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.layers import SelectAdaptivePool2d
  from ._registry import register_model, generate_default_cfgs
  from ._builder import build_model_with_cfg
  from ._manipulate import checkpoint_seq
label_desc: Use image node_id 1 to create a new ConvMixer object from inherited base classes: nn with example: obj = ConvMixer(dim, depth, kernel_size, patch_size, in_chans, num_classes, global_pool, drop_rate, act_layer)