code: def _apply_attention(ops, attention, X, lengths):
      output = X * attention
  
      def apply_attention_bwd(d_output):
          d_attention = (X * d_output).sum(axis=1, keepdims=True)
          dX = d_output * attention
          return dX, d_attention
  
      return output, apply_attention_bwd
  
file_path: thinc/thinc/layers/parametricattention_v2.py
imports: from typing import Callable, Optional, Tuple, cast
  from ..config import registry
  from ..model import Model
  from ..types import Floats2d, Ragged
  from ..util import get_width
  from .noop import noop
label_desc: Use image node_id 5 for calling a global function with example usage: _apply_attention(ops, attention, X, lengths) and returns: output,  apply_attention_bwd, dX,  d_attention