code: def dot_attention(
      F,
      queries: Tensor,
      keys: Tensor,
      values: Tensor,
      mask: Optional[Tensor] = None,
      dropout: float = 0.0,
  ) -> Tensor:
      r"""
  
      Parameters
      ----------
      queries
          Attention queries of shape (n, lq, d)
      keys
          Attention keys of shape (n, lk, d)
      values
          Attention values of shape (n, lk, dv)
      mask
          Optional mask tensor
      dropout
          Dropout rate
  
      Returns
      -------
      'Context' vectors for each query of shape (n, lq, dv)
      """
  
      # (n, lq, lk)
      logits = F.batch_dot(lhs=queries, rhs=keys, transpose_b=True)
  
      if mask is not None:
          logits = F.broadcast_add(logits, mask)
  
      probs = F.softmax(logits, axis=-1)
      probs = F.Dropout(probs, p=dropout) if dropout > 0.0 else probs
  
      # (n, lq, lk) x (n, lk, dv) -> (n, lq, dv)
      return F.batch_dot(lhs=probs, rhs=values)
  
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 a global function with example usage: dot_attention(F, queries, keys, values, mask, dropout) and returns: F