class_docstr: BiAttentionBlock Module:
  
  First, multi-level visual features are concat; Then the concat visual
  feature and lang feature are fused by attention; Finally the newly visual
  feature are split into multi levels.
  
  Args:
      v_dim (int): The dimension of the visual features.
      l_dim (int): The dimension of the language feature.
      embed_dim (int): The embedding dimension for the attention operation.
      num_heads (int): The number of attention heads.
      dropout (float, optional): The dropout probability. Defaults to 0.1.
      drop_path (float, optional): The drop path probability.
          Defaults to 0.0.
      init_values (float, optional):
          The initial value for the scaling parameter.
          Defaults to 1e-4.
class_docstr_tok: ["BiAttentionBlock","Module",":","First",",","multi-level","visual","features","are","concat",";","Then","the","concat","visual","feature","and","lang","feature","are","fused","by","attention",";","Finally","the","newly","visual","feature","are","split","into","multi","levels",".","Args",":","v_dim","(","int",")",":","The","dimension","of","the","visual","features",".","l_dim","(","int",")",":","The","dimension","of","the","language","feature",".","embed_dim","(","int",")",":","The","embedding","dimension","for","the","attention","operation",".","num_heads","(","int",")",":","The","number","of","attention","heads",".","dropout","(","float",",","optional",")",":","The","dropout","probability",".","Defaults","to","0.1.","drop_path","(","float",",","optional",")",":","The","drop","path","probability",".","Defaults","to","0.0.","init_values","(","float",",","optional",")",":","The","initial","value","for","the","scaling","parameter",".","Defaults","to","1e-4","."]
code: def __init__(
      self,
      v_dim: int,
      l_dim: int,
      embed_dim: int,
      num_heads: int,
      dropout: float = 0.1,
      drop_path: float = 0.0,
      init_values: float = 1e-4,
  ):
      super().__init__()
  
      # pre layer norm
      self.layer_norm_v = nn.LayerNorm(v_dim)
      self.layer_norm_l = nn.LayerNorm(l_dim)
      self.attn = BiMultiHeadAttention(
          v_dim=v_dim,
          l_dim=l_dim,
          embed_dim=embed_dim,
          num_heads=num_heads,
          dropout=dropout,
      )
  
      # add layer scale for training stability
      self.drop_path = (
          DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
      )
      self.gamma_v = nn.Parameter(
          init_values * torch.ones(v_dim), requires_grad=True
      )
      self.gamma_l = nn.Parameter(
          init_values * torch.ones(l_dim), requires_grad=True
      )
  
imports: import math
  from typing import Dict, Optional, Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils.checkpoint
  from mmcv.cnn.bricks import DropPath
  from torch import Tensor
label_desc: Use image node_id 1 to create a new BiAttentionBlock object from inherited base classes: nn with example: obj = BiAttentionBlock(v_dim, l_dim, embed_dim, num_heads, dropout, drop_path, init_values)