class_docstr: Vision Transformer Model
  Args:
      img_size (`int`):
          Image height or width (height=width).
      patch_size (`int`):
          Patch height or width (height=width).
      in_c (`int`):
          Number of image channels.
      num_classes (`int`):
          Number of classes.
      embed_dim (`int`):
          Number of features.
      depth (`int`):
          Number of blocks.
      num_heads (`int`):
          Number of heads for Multi-Attention layer.
      mlp_ratio (`float`):
          Mlp ratio.
      qkv_bias (`bool`):
          If add bias to qkv layer.
      qk_scale (`float`):
          Number to scale qk
      representation_size (`int`):
          Size of representations.
      drop_ratio (`float`):
          Drop rate of a block
      attn_drop_ratio (`float`):
          Drop rate of attention layer
      drop_path_ratio (`float`):
          Drop rate of drop_path layer
      embed_layer (`nn.Module`):
          Patch embedding layer.
      norm_layer (`nn.Module`):
          Normalization layer.
      act_layer(`nn.Module`):
          Activation layer.
class_docstr_tok: ["Vision","Transformer","Model","Args",":","img_size","(","`","int","`",")",":","Image","height","or","width","(","height=width",")",".","patch_size","(","`","int","`",")",":","Patch","height","or","width","(","height=width",")",".","in_c","(","`","int","`",")",":","Number","of","image","channels",".","num_classes","(","`","int","`",")",":","Number","of","classes",".","embed_dim","(","`","int","`",")",":","Number","of","features",".","depth","(","`","int","`",")",":","Number","of","blocks",".","num_heads","(","`","int","`",")",":","Number","of","heads","for","Multi-Attention","layer",".","mlp_ratio","(","`","float","`",")",":","Mlp","ratio",".","qkv_bias","(","`","bool","`",")",":","If","add","bias","to","qkv","layer",".","qk_scale","(","`","float","`",")",":","Number","to","scale","qk","representation_size","(","`","int","`",")",":","Size","of","representations",".","drop_ratio","(","`","float","`",")",":","Drop","rate","of","a","block","attn_drop_ratio","(","`","float","`",")",":","Drop","rate","of","attention","layer","drop_path_ratio","(","`","float","`",")",":","Drop","rate","of","drop_path","layer","embed_layer","(","`","nn.Module","`",")",":","Patch","embedding","layer",".","norm_layer","(","`","nn.Module","`",")",":","Normalization","layer",".","act_layer","(","`","nn.Module","`",")",":","Activation","layer","."]
code: def forward_features(self, x):
      # [B, C, H, W] -> [B, num_patches, embed_dim]
      x = self.patch_embed(x)  # [B, 196, 768]
      # [1, 1, 768] -> [B, 1, 768]
      cls_token = self.cls_token.expand(x.shape[0], -1, -1)
      x = torch.cat((cls_token, x), dim=1)  # [B, 197, 768]
  
      x = self.add([x, self.pos_embed])
      x.register_hook(self.save_inp_grad)
      x = self.pos_drop(x)
      for blk in self.blocks:
          x = blk(x)
      x = self.norm(x)
      return self.pre_logits(x[:, 0])
  
file_path: towhee/towhee/models/vit/vit.py
imports: import torch
  from torch import nn
  from torch.utils import model_zoo
  from functools import partial
  from collections import OrderedDict
  from towhee.models.utils.init_vit_weights import init_vit_weights
  from towhee.models.layers.patch_embed2d import PatchEmbed2D
  from .vit_utils import get_configs
  from .vit_block import Block
  from towhee.models.layers.layers_with_relprop import LayerNorm, GELU, Linear, IndexSelect, Add
label_desc: Use image node_id 2 for calling the VitModel obj's underlying member method code with example usage: obj.forward_features(x) and returns: self