class_docstr: Multi-headed attention.
  
  See "Attention Is All You Need" for more details.
code: def reset_parameters(self):
      if self.qkv_same_dim:
          # Empirically observed the convergence to be much better with
          # the scaled initialization
          nn.init.xavier_uniform_(
              self.k_proj.weight, gain=1 / math.sqrt(2)
          )
          nn.init.xavier_uniform_(
              self.v_proj.weight, gain=1 / math.sqrt(2)
          )
          nn.init.xavier_uniform_(
              self.q_proj.weight, gain=1 / math.sqrt(2)
          )
      else:
          nn.init.xavier_uniform_(self.k_proj.weight)
          nn.init.xavier_uniform_(self.v_proj.weight)
          nn.init.xavier_uniform_(self.q_proj.weight)
  
      nn.init.xavier_uniform_(self.out_proj.weight)
      if self.out_proj.bias is not None:
          nn.init.constant_(self.out_proj.bias, 0.0)
      if self.bias_k is not None:
          nn.init.xavier_normal_(self.bias_k)
      if self.bias_v is not None:
          nn.init.xavier_normal_(self.bias_v)
      if self.has_relative_attention_bias:
          nn.init.xavier_normal_(self.relative_attention_bias.weight)
  
imports: import math
  import numpy
  from typing import Dict, Optional, Tuple
  import torch
  from torch import Tensor, nn
  import torch.nn.functional
  from torch.nn import LayerNorm, Parameter
  from lavis.models.beats.modules import GradMultiply, SamePad, get_activation_fn, GLU_Linear, quant_noise
label_desc: Use image node_id 2 for calling the MultiheadAttention obj's underlying member method code with example usage: obj.reset_parameters() without return types