code: def _ragged_forward(
      layer: Model[List2d, List2d], Xr: Ragged, is_train: bool
  ) -> Tuple[Ragged, Callable]:
      # Assign these to locals, to keep code a bit shorter.
      unflatten = layer.ops.unflatten
      flatten = layer.ops.flatten
      # It's worth being a bit careful about memory here, as the activations
      # are potentially large on GPU. So we make nested function calls instead
      # of assigning to temporaries where possible, so memory can be reclaimed
      # sooner.
      Ys, get_dXs = layer(unflatten(Xr.data, Xr.lengths), is_train)
  
      def backprop(dYr: Ragged):
          return Ragged(
              flatten(get_dXs(unflatten(dYr.data, dYr.lengths))),
              dYr.lengths,
          )
  
      return Ragged(flatten(Ys), Xr.lengths), backprop
  
file_path: thinc/thinc/layers/with_list.py
imports: from typing import Callable, List, Optional, Tuple, TypeVar, Union, cast
  from ..config import registry
  from ..model import Model
  from ..types import Array2d, Floats2d, Ints2d, List2d, Padded, Ragged
label_desc: Use image node_id 5 for calling a global function with example usage: _ragged_forward(layer, Xr, is_train) and returns: Ragged,  backprop, Ragged