code: def forward(
      model: Model, source_spans: Tuple[Ragged, Ragged], is_train: bool
  ) -> Tuple[Ragged, Callable]:
      """Get subsequences from source vectors."""
      ops = model.ops
      X, spans = source_spans
      assert spans.dataXd.ndim == 2
      indices = _get_span_indices(ops, spans, X.lengths)
      if len(indices) > 0:
          Y = Ragged(X.dataXd[indices], spans.dataXd[:, 1] - spans.dataXd[:, 0])  # type: ignore[arg-type, index]
      else:
          Y = Ragged(
              ops.xp.zeros(X.dataXd.shape, dtype=X.dataXd.dtype),
              ops.xp.zeros((len(X.lengths),), dtype="i"),
          )
      x_shape = X.dataXd.shape
      x_lengths = X.lengths
  
      def backprop_windows(dY: Ragged) -> Tuple[Ragged, Ragged]:
          dX = Ragged(ops.alloc2f(*x_shape), x_lengths)
          ops.scatter_add(dX.dataXd, indices, dY.dataXd)  # type: ignore[arg-type]
          return (dX, spans)
  
      return Y, backprop_windows
  
file_path: spaCy/spacy/ml/extract_spans.py
imports: from typing import Callable, List, Tuple
  from thinc.api import Model, to_numpy
  from thinc.types import Ints1d, Ragged
  from ..util import registry
label_desc: Use image node_id 3 for calling a global function with example usage: forward(model, source_spans, is_train) and returns: Y,  backprop_windows, dX,  spans