class_docstr: Residual Attention Block
  Args:
      d_model (int): dimension of model
      n_head (int): number of head
      attn_mask (Union[torch.Tensor, Callable]): mask for attention
      vis (int): visualization
      patch_nums (int): number of patches
      is_bridge_former_video (bool): text transformer or visual transformer for a single frame
code: def __init__(
      self,
      d_model: int,
      n_head: int,
      attn_mask: Union[torch.Tensor, Callable] = None,
      vis=False,
      patch_nums=None,
      is_bridge_former_video=False,
  ):
      super().__init__()
      self.vis = vis
      self.attn = nn.MultiheadAttention(d_model, n_head)
      if vis:
          self.attn = MultiheadAttention(d_model, n_head)
      self.ln_1 = LayerNorm(d_model)
      self.mlp = nn.Sequential(
          OrderedDict(
              [
                  ("c_fc", nn.Linear(d_model, d_model * 4)),
                  ("gelu", QuickGELU()),
                  ("c_proj", nn.Linear(d_model * 4, d_model)),
              ]
          )
      )
      self.ln_2 = LayerNorm(d_model)
      self.attn_mask = attn_mask
      self.patch_nums = patch_nums
      self.is_bridge_former_video = is_bridge_former_video
      self.attn_probs = None
      self.attn_grad = None
  
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 1 to create a new ResidualAttentionBlock object from inherited base classes: nn with example: obj = ResidualAttentionBlock(d_model, n_head, attn_mask, vis, patch_nums, is_bridge_former_video)