code: def concatenate(*layers: Model) -> Model[InT, XY_XY_OutT]:
      """Compose two or more models `f`, `g`, etc, such that their outputs are
      concatenated, i.e. `concatenate(f, g)(x)` computes `hstack(f(x), g(x))`.
      Also supports chaining more than 2 layers.
      """
      if not layers:
          return cast(Model[InT, XY_XY_OutT], noop())
      elif len(layers) == 1:
          return layers[0]
      elif layers[0]._func is forward:
          layers[0].layers.extend(layers[1:])
          return layers[0]
  
      # only add an nI dimension if each sub-layer has one
      dims: Dict[str, Optional[int]] = {"nO": None}
      if all(node.has_dim("nI") in [True, None] for node in layers):
          dims = {"nO": None, "nI": None}
  
      return Model(
          "|".join(layer.name for layer in layers),
          forward,
          init=init,
          dims=dims,
          layers=layers,
      )
  
file_path: thinc/thinc/layers/concatenate.py
imports: from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, TypeVar, Union, cast
  from ..backends import NumpyOps
  from ..config import registry
  from ..model import Model
  from ..types import Array2d, Ragged, XY_XY_OutT
  from ..util import get_width
  from .noop import noop
label_desc: Use image node_id 1 for calling a global function with example usage: concatenate() and returns: Model, cast, layers, layers