code: def _get_input_req_attr(
      kernel_fns: list[LayerKernelFn],
      fold: Callable[[Diagonal, Diagonal], Diagonal],
  ) -> dict[str, Any]:
      """Gets requirements of the combined layer based on individual requirements.
  
      Specifically, gets the requirements / allowances to the inputs to a `serial`
      or `parallel` sequence of layers based on requirements of each layer, setting
      requirements / allowances to the most / least demanding among all layers.
  
      Args:
        kernel_fns:
          list of `kernel_fn`s fed to the `kernel_fns` (e.g. a list of
          convolutional layers and nonlinearities to be chained together with the
          `serial` combinator) or evaluated in parallel (`parallel` combinator).
  
        fold:
          binary associative operator to combine allowances of consecutive
          individual `kernel_fn`s. Can be only `operator.rshift` (`>>`), i.e.
          composition (corresponding to `serial`) or `operator.and_`, (`&`), i.e.
          `AND` (corresponding to `parallel`).
  
      Returns:
        A `dict` with combined requirements / allowances.
      """
      req = {}
  
      for f in kernel_fns:
          req_f = get_req(f, default=frozendict.frozendict())
  
          for k, v in req_f.items():
              if k == "use_dropout":
                  if k in req and req[k] != v:
                      raise ValueError(
                          "`use_dropout` is a single whole-network attribute "
                          "and cannot be set to different values."
                      )
                  req[k] = v
  
              elif k in ("batch_axis", "channel_axis"):
                  if k not in req:
                      req[k] = v
                  else:
                      if fold is op.and_:
                          if k in req and req[k] != v:
                              if (req[k] >= 0 and v >= 0) or (
                                  req[k] < 0 and v < 0
                              ):
                                  warnings.warn(
                                      f"For `kernel_fn`, `{k}` parameters must match in"
                                      f" all parallel branches, got {req[k]} and {v}. "
                                      f"This WILL lead to [silent] errors if "
                                      f"`kernel_fn` is called."
                                  )
                              else:
                                  warnings.warn(
                                      f"Got potentially mismatching `{k}` values in "
                                      f"parallel branches: {req[k]} and {v}."
                                  )
  
                      elif fold is not op.rshift:
                          raise ValueError(fold)
  
              elif k in ("diagonal_batch", "diagonal_spatial"):
                  if k in req:
                      req[k] = fold(req[k], v)
                  else:
                      req[k] = v
  
              else:
                  raise NotImplementedError(k)
  
      return req
  
imports: import operator
  from typing import Any, Callable
  import warnings
  import frozendict
  import jax
  from jax import lax
  from jax import random
  import jax.example_libraries.stax
  from ..utils.kernel import Kernel
  from ..utils.typing import InternalLayer
  from ..utils.typing import Layer
  from ..utils.typing import LayerKernelFn
  from ..utils.typing import NTTree
  from ..utils.typing import NTTrees
  from ..utils.typing import Shapes
  from .requirements import Diagonal
  from .requirements import get_req
  from .requirements import layer
  from .requirements import requires
label_desc: Use image node_id 4 for calling a global function with example usage: _get_input_req_attr(kernel_fns, fold) and returns: req