code: def forward(
      model: Model[InT, OutT], X: InT, is_train: bool
  ) -> Tuple[OutT, Callable]:
      nO = model.get_dim("nO")
      nP = model.get_dim("nP")
      nI = model.get_dim("nI")
      b = model.get_param("b")
      W = model.get_param("W")
      W = model.ops.reshape2f(W, nO * nP, nI)
      Y = model.ops.gemm(X, W, trans2=True)
      Y += model.ops.reshape1f(b, nO * nP)
      Z = model.ops.reshape3f(Y, Y.shape[0], nO, nP)
      best, which = model.ops.maxout(Z)
  
      def backprop(d_best: OutT) -> InT:
          dZ = model.ops.backprop_maxout(d_best, which, nP)
          # TODO: Add sum methods for Floats3d
          model.inc_grad("b", dZ.sum(axis=0))  # type: ignore[call-overload]
          dY = model.ops.reshape2f(dZ, dZ.shape[0], nO * nP)
          dW = model.ops.reshape3f(
              model.ops.gemm(dY, X, trans1=True), nO, nP, nI
          )
          model.inc_grad("W", dW)
          return model.ops.gemm(dY, model.ops.reshape2f(W, nO * nP, nI))
  
      return best, backprop
  
file_path: thinc/thinc/layers/maxout.py
imports: from typing import Callable, Optional, Tuple, cast
  from ..config import registry
  from ..initializers import glorot_uniform_init, zero_init
  from ..model import Model
  from ..types import Floats2d
  from ..util import get_width, partial
  from .chain import chain
  from .dropout import Dropout
  from .layernorm import LayerNorm
label_desc: Use image node_id 2 for calling a global function with example usage: forward(model, X, is_train) and returns: best,  backprop, model