code: def forward(
      model: Model[Ints1d, OutT], ids: Ints1d, is_train: bool
  ) -> Tuple[OutT, Callable]:
      vectors = cast(Floats2d, model.get_param("E"))
      nO = vectors.shape[1]
      nN = ids.shape[0]
      dropout: Optional[float] = model.attrs.get("dropout_rate")
      output = vectors[ids]
      drop_mask = None
      if is_train:
          drop_mask = cast(
              Floats1d, model.ops.get_dropout_mask((nO,), dropout)
          )
          if drop_mask is not None:
              output *= drop_mask
  
      def backprop(d_output: OutT) -> Ints1d:
          if drop_mask is not None:
              d_output *= drop_mask
          d_vectors = model.ops.alloc2f(*vectors.shape)
          model.ops.scatter_add(d_vectors, ids, d_output)
          model.inc_grad("E", d_vectors)
          dX = model.ops.alloc1i(nN)
          return dX
  
      return output, backprop
  
file_path: thinc/thinc/layers/embed.py
imports: from typing import Callable, Dict, Optional, Tuple, TypeVar, Union, cast
  from ..config import registry
  from ..initializers import uniform_init
  from ..model import Model
  from ..types import Floats1d, Floats2d, Ints1d, Ints2d
  from ..util import get_width, partial
  from .array_getitem import ints_getitem
  from .chain import chain
label_desc: Use image node_id 2 for calling a global function with example usage: forward(model, ids, is_train) and returns: output,  backprop, dX