class_docstr: Multiheaded Scaled Dot Product Attention. This function
  has the same exact signature as the one used in pytorch_translate
  with the added benefit of supporting torchscript
class_docstr_tok: ["Multiheaded","Scaled","Dot","Product","Attention",".","This","function","has","the","same","exact","signature","as","the","one","used","in","pytorch_translate","with","the","added","benefit","of","supporting","torchscript"]
code: def __init__(
      self,
      embed_dim: int,
      context_dim: int,
      num_heads: int,
      dropout: float,
      unseen_mask=False,
      src_length_mask=True,
  ):
      super().__init__()
      assert embed_dim == context_dim
      d_model = embed_dim
      assert d_model % num_heads == 0
  
      if unseen_mask:
          raise NotImplementedError(
              "Unseen mask not supported with sequential decoding"
          )
      self._attn = MultiheadAttention(d_model, num_heads, dropout)
      self.use_src_length_mask = src_length_mask
  
imports: from typing import Dict, Optional, Tuple
  import numpy
  import torch
  import torch.nn.functional
  from pytext.config import ConfigBase
  from pytext.utils.usage import log_class_usage
  from torch import nn, Tensor
  from .base import PyTextIncrementalDecoderComponent
  from .utils import Linear
label_desc: Use image node_id 1 to create a new DecoupledMultiheadAttention object from inherited base classes: nn with example: obj = DecoupledMultiheadAttention(embed_dim, context_dim, num_heads, dropout, unseen_mask, src_length_mask)