code: def forward(
      model: Model[InT, OutT], X: InT, is_train: bool
  ) -> Tuple[OutT, Callable]:
      """Apply the layers of `model` in sequence, feeding the output from one
      layer into the next.
      """
      callbacks = []
      for layer in model.layers:
          Y, inc_layer_grad = layer(X, is_train=is_train)
          callbacks.append(inc_layer_grad)
          X = Y
  
      def backprop(dY: OutT) -> InT:
          for callback in reversed(callbacks):
              dX = callback(dY)
              dY = dX
          return dX
  
      return Y, backprop
  
file_path: thinc/thinc/layers/chain.py
imports: from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, cast
  from ..config import registry
  from ..model import Model
  from ..types import XY_YZ_OutT
  from ..util import get_width
label_desc: Use image node_id 3 for calling a global function with example usage: forward(model, X, is_train) and returns: Y,  backprop, dX