code: def add(
      layer1: Model[InT, OutT], layer2: Model[InT, OutT], *layers: Model
  ) -> Model[InT, XY_XY_OutT]:
      """Compose two or more models `f`, `g`, etc, such that their outputs are
      added, i.e. `add(f, g)(x)` computes `f(x) + g(x)`.
      """
      layers = (layer1, layer2) + layers
      if layers[0].name == "add":
          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("add", forward, init=init, dims=dims, layers=layers)
  
imports: from typing import Any, Callable, Dict, Optional, Tuple, TypeVar
  from ..config import registry
  from ..model import Model
  from ..types import ArrayXd, XY_XY_OutT
  from ..util import get_width
label_desc: Use image node_id 1 for calling a global function with example usage: add(layer1, layer2) and returns: Model, layers