class_docstr: Multi-head self-attention. Independent linear projections of inputs serve
  as queries, keys, and values for the attention.
  
  Parameters
  ----------
  att_dim_in
      Attention dimension (number of hidden units)
  heads
      Number of attention heads
  att_dim_out
      Output dimension (number of output units)
  dropout
      Dropout rate on attention scores
class_docstr_tok: ["Multi-head","self-attention",".","Independent","linear","projections","of","inputs","serve","as","queries",",","keys",",","and","values","for","the","attention",".","Parameters","--","--","--","--","--","att_dim_in","Attention","dimension","(","number","of","hidden","units",")","heads","Number","of","attention","heads","att_dim_out","Output","dimension","(","number","of","output","units",")","dropout","Dropout","rate","on","attention","scores"]
docstr: Computes multi-head attention on a set of inputs, serving as queries,
  keys, and values. If sequence lengths are provided, they will be used
  to mask the attention scores. May also use a cache of previously
  computed inputs.
  
  Parameters
  ----------
  inputs
      Input data of shape (batch_size, max_length, att_dim_in)
  mask
      Optional tensor to mask attention scores
  cache
      Optional dictionary of previously computed keys and values
  
  Returns
  -------
  Tensor
      A tensor of shape (batch_size, max_length, att_dim_out)
docstr_tok: ["Computes","multi-head","attention","on","a","set","of","inputs",",","serving","as","queries",",","keys",",","and","values",".","If","sequence","lengths","are","provided",",","they","will","be","used","to","mask","the","attention","scores",".","May","also","use","a","cache","of","previously","computed","inputs",".","Parameters","--","--","--","--","--","inputs","Input","data","of","shape","(","batch_size",",","max_length",",","att_dim_in",")","mask","Optional","tensor","to","mask","attention","scores","cache","Optional","dictionary","of","previously","computed","keys","and","values","Returns","--","--","--","-","Tensor","A","tensor","of","shape","(","batch_size",",","max_length",",","att_dim_out",")"]
code: def hybrid_forward(
      self,
      F,
      inputs: Tensor,
      mask: Optional[Tensor] = None,
      cache: Optional[Dict[str, Optional[Tensor]]] = None,
  ) -> Tuple[Tensor, Optional[Dict]]:
      r"""
      Computes multi-head attention on a set of inputs, serving as queries,
      keys, and values. If sequence lengths are provided, they will be used
      to mask the attention scores. May also use a cache of previously
      computed inputs.
  
      Parameters
      ----------
      inputs
          Input data of shape (batch_size, max_length, att_dim_in)
      mask
          Optional tensor to mask attention scores
      cache
          Optional dictionary of previously computed keys and values
  
      Returns
      -------
      Tensor
          A tensor of shape (batch_size, max_length, att_dim_out)
      """
  
      # Q = K = V -> Q * W_q, K * W_k, V * W_v
  
      # combined: (batch_size, max_length, att_dim_in * 3)
      combined = self.dense_pre_satt(inputs)
  
      # split into queries, keys and values
      # (batch_size, max_length, att_dim_in)
      queries, keys, values = F.split(
          data=combined, num_outputs=3, axis=2
      )
  
      if cache is not None:
          # append new keys and values to cache, update the cache
          keys = cache["k"] = (
              keys
              if "k" not in cache.keys()
              else F.concat(cache["k"], keys, dim=1)
          )
          values = cache["v"] = (
              values
              if "v" not in cache.keys()
              else F.concat(cache["v"], values, dim=1)
          )
  
      return self._attend(F, queries, keys, values, mask), cache
  
imports: from typing import Dict, Optional, Tuple
  import mxnet
  from mxnet.gluon import HybridBlock
  from gluonts.mx import Tensor
label_desc: Use image node_id 2 for calling the MultiHeadSelfAttention obj's underlying member method code with example usage: obj.hybrid_forward(F, inputs, mask, cache) and returns: self,  cache