code: def _get_attention(ops, Q, X, lengths):
      attention = ops.gemm(X, ops.reshape2f(Q, -1, 1))
      attention = ops.softmax_sequences(attention, lengths)
  
      def get_attention_bwd(d_attention):
          d_attention = ops.backprop_softmax_sequences(
              d_attention, attention, lengths
          )
          dQ = ops.gemm(X, d_attention, trans1=True)
          dX = ops.xp.outer(d_attention, Q)
          return dQ, dX
  
      return attention, get_attention_bwd
  
file_path: thinc/thinc/layers/parametricattention.py
imports: from typing import Callable, Optional, Tuple
  from ..config import registry
  from ..model import Model
  from ..types import Ragged
  from ..util import get_width
label_desc: Use image node_id 4 for calling a global function with example usage: _get_attention(ops, Q, X, lengths) and returns: attention,  get_attention_bwd, dQ,  dX