class_docstr: Multi-Head Attention module.
  
  Args:
      n_head (int): The number of heads in the
          multiheadattention models (default=8).
      d_model (int): The number of expected features
          in the decoder inputs (default=512).
      d_k (int): Total number of features in key.
      d_v (int): Total number of features in value.
      dropout (float): Dropout layer on attn_output_weights.
      qkv_bias (bool): Add bias in projection layer. Default: False.
code: def __init__(
      self,
      n_head=8,
      d_model=512,
      d_k=64,
      d_v=64,
      dropout=0.1,
      qkv_bias=False,
  ):
      super().__init__()
      self.n_head = n_head
      self.d_k = d_k
      self.d_v = d_v
  
      self.dim_k = n_head * d_k
      self.dim_v = n_head * d_v
  
      self.linear_q = nn.Linear(self.dim_k, self.dim_k, bias=qkv_bias)
      self.linear_k = nn.Linear(self.dim_k, self.dim_k, bias=qkv_bias)
      self.linear_v = nn.Linear(self.dim_v, self.dim_v, bias=qkv_bias)
  
      self.attention = ScaledDotProductAttention(d_k**0.5, dropout)
  
      self.fc = nn.Linear(self.dim_v, d_model, bias=qkv_bias)
      self.proj_drop = nn.Dropout(dropout)
  
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmocr.registry import MODELS
label_desc: Use image node_id 1 to create a new MultiHeadAttention object from inherited base classes: nn with example: obj = MultiHeadAttention(n_head, d_model, d_k, d_v, dropout, qkv_bias)