code: def __init__(self, emb_dim: int, num_heads: int):
      super().__init__()
      self.q_proj = nn.Linear(emb_dim, emb_dim, bias_attr=True)
      self.k_proj = nn.Linear(emb_dim, emb_dim, bias_attr=True)
      self.v_proj = nn.Linear(emb_dim, emb_dim, bias_attr=True)
      self.c_proj = nn.Linear(emb_dim, emb_dim, bias_attr=True)
      self.head_dim = emb_dim // num_heads
      self.emb_dim = emb_dim
      self.num_heads = num_heads
      assert (
          self.head_dim * num_heads == emb_dim
      ), "embed_dim must be divisible by num_heads"
  
imports: from typing import Optional
  import paddle
  import paddle.nn
  from paddle import Tensor
  from paddle.nn import functional
  from paddle.nn import Linear
label_desc: Use image node_id 1 to create a new MultiHeadAttention object from inherited base classes: nn with example: obj = MultiHeadAttention(emb_dim, num_heads)