code: def __init__(
      self,
      embed_dim: int,
      num_heads: int,
      dropout: float = 0.0,
      bias: bool = True,
      add_bias_kv: bool = False,
      add_zero_attn: bool = False,
      kdim: Optional[int] = None,
      vdim: Optional[int] = None,
      batch_first: bool = False,
      device=None,
      dtype=None,
  ) -> None:
      factory_kwargs = {"device": device, "dtype": dtype}
      super().__init__(
          embed_dim,
          num_heads,
          dropout,
          bias,
          add_bias_kv,
          add_zero_attn,
          kdim,
          vdim,
          batch_first,
          **factory_kwargs,
      )
      self.linear_Q = nn.Linear(
          self.embed_dim, self.embed_dim, bias=bias, **factory_kwargs
      )
      self.linear_K = nn.Linear(
          self.kdim, self.embed_dim, bias=bias, **factory_kwargs
      )
      self.linear_V = nn.Linear(
          self.vdim, self.embed_dim, bias=bias, **factory_kwargs
      )
      # for the type: ignore, see https://github.com/pytorch/pytorch/issues/58969
      self.out_proj = nn.Linear(self.embed_dim, self.embed_dim, bias=bias, **factory_kwargs)  # type: ignore[assignment]
  
      # Functionals
      self.q_scaling_product = torch.ao.nn.quantized.FloatFunctional()
      # note: importing torch.ao.nn.quantized at top creates a circular import
  
      # Quant/Dequant
      self.quant_attn_output = torch.ao.quantization.QuantStub()
      self.quant_attn_output_weights = torch.ao.quantization.QuantStub()
      self.dequant_q = torch.ao.quantization.DeQuantStub()
      self.dequant_k = torch.ao.quantization.DeQuantStub()
      self.dequant_v = torch.ao.quantization.DeQuantStub()
  
file_path: pytorch/torch/ao/nn/quantizable/modules/activation.py
imports: import torch
  import torch.jit
  from torch import nn
  import torch.nn.functional
  from torch import Tensor
  from typing import Optional, Tuple
  import warnings
label_desc: Use image node_id 1 to create a new MultiheadAttention object from inherited base classes: nn with example: obj = MultiheadAttention(embed_dim, num_heads, dropout, bias, add_bias_kv, add_zero_attn, kdim, vdim, batch_first, device, dtype)