class_docstr: ViT for clip
  Args:
      input_resolution (int): input resolution
      patch_size (int): patch size
      width (int): width
      layers (int): number of layers
      heads (int): number of heads
      output_dim (int): output dimension
      vis (bool): visualization
      is_bridgeformer (bool): is bridge model or not
      is_bridge_former_video (bool): text transformer or visual transformer for a single frame
code: def forward(self, x: torch.Tensor):
      if self.is_bridgeformer:
          bz = x.shape[0]
          n_frames = x.shape[1]
          c = x.shape[2]
          h = x.shape[3]
          w = x.shape[4]
          x = x.contiguous().view(-1, c, h, w)
  
          x = self.conv1(x)  # shape = [bz*n_frames, width, grid, grid]
  
          x = x.reshape(
              x.shape[0], x.shape[1], -1
          )  # shape = [bz*n_frames, width, grid*grid]
  
          x = x.permute(
              0, 2, 1
          )  # shape = [bz*n_frames, grid*grid, width]
  
          x = x.reshape(
              bz, -1, x.shape[-1]
          )  # shape = [bz, n_frames*grid*grid, width]
  
          cls = self.class_embedding.to(x.dtype) + torch.zeros(
              x.shape[0], 1, x.shape[-1], dtype=x.dtype, device=x.device
          )  # shape = [bz, 1, width]
  
          x = torch.cat(
              [cls, x], dim=1
          )  # shape = [bz, n_frames*grid*grid + 1, width]
          cls_embed = self.positional_embedding[
              0:1, :
          ]  # shape = [1, width]
          tile_pos_embed = self.positional_embedding[1:, :].repeat(
              n_frames, 1
          )  # shape = [n_frames*grid*grid, width]
          # temporal embed needs to be repeated within each frame (this does [1,2,3] --> [1,1,1,2,2,2,3,3,3]...)
          total_pos_embed = torch.cat(
              [cls_embed, tile_pos_embed], dim=0
          )  # shape = [n_frames*grid*grid+1, width]
          x = x + total_pos_embed.to(
              x.dtype
          )  # shape = [bz,n_frames*grid*grid+1, width]
      else:
          x = self.conv1(x)  # shape = [*, width, grid, grid]
          x = x.reshape(
              x.shape[0], x.shape[1], -1
          )  # shape = [*, width, grid ** 2]
          x = x.permute(0, 2, 1)  # shape = [*, grid ** 2, width]
          x = torch.cat(
              [
                  self.class_embedding.to(x.dtype)
                  + torch.zeros(
                      x.shape[0],
                      1,
                      x.shape[-1],
                      dtype=x.dtype,
                      device=x.device,
                  ),
                  x,
              ],
              dim=1,
          )  # shape = [*, grid ** 2 + 1, width]
  
          x = x + self.positional_embedding.to(x.dtype)
      x = self.ln_pre(x)
  
      x = x.permute(1, 0, 2)  # NLD -> LND
      x = self.transformer(x)
      x = x.permute(1, 0, 2)  # LND -> NLD
  
      x = self.ln_post(x[:, 0, :])
  
      if self.proj is not None:
          x = x @ self.proj
  
      return x
  
imports: import os
  import warnings
  from collections import OrderedDict
  from typing import Tuple, Union, Callable
  import numpy
  from PIL import Image
  import torch
  from torch import nn
  from torchvision.transforms import Compose, Resize, CenterCrop, ToTensor, Normalize
  from towhee.models.utils.download import download_from_url
  from towhee.models.clip.clip_utils import get_configs, convert_weights, patch_device, patch_float, tokenize
  from towhee.models.clip.auxilary import multi_head_attention_forward, MultiheadAttention
label_desc: Use image node_id 2 for calling the VisionTransformer obj's underlying member method code with example usage: obj.forward(x) and returns: x