code: def _ragged_forward(
      layer: Model[Padded, Padded], Xr: Ragged, is_train: bool
  ) -> Tuple[Ragged, Callable]:
      # Assign these to locals, to keep code a bit shorter.
      list2padded = layer.ops.list2padded
      padded2list = layer.ops.padded2list
      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.
      Yp, get_dXp = layer(
          list2padded(unflatten(Xr.data, Xr.lengths)), is_train
      )
  
      def backprop(dYr: Ragged):
          flattened = flatten(
              padded2list(
                  get_dXp(list2padded(unflatten(dYr.data, dYr.lengths)))
              ),
          )
          return Ragged(flattened, dYr.lengths)
  
      flattened = flatten(padded2list(Yp))
      return Ragged(flattened, Xr.lengths), backprop
  
file_path: thinc/thinc/layers/with_padded.py
imports: from typing import Callable, List, Optional, Tuple, TypeVar, Union, cast
  from ..config import registry
  from ..model import Model
  from ..types import Array2d, Floats3d, Ints1d, List2d, Padded, Ragged
  from ..util import is_xp_array
label_desc: Use image node_id 8 for calling a global function with example usage: _ragged_forward(layer, Xr, is_train) and returns: Ragged,  backprop, Ragged