class_docstr: Network consisting of Tensorforce layers (specification key: `custom` or `layered`), which can
  be specified as either a list of layer specifications in the case of a standard sequential
  layer-stack architecture, or as a list of list of layer specifications in the case of a more
  complex architecture consisting of multiple sequential layer-stacks. Note that the final
  action/value layer of the policy/baseline network is implicitly added, so the network output can
  be of arbitrary size and use any activation function, and is only required to be a rank-one
  embedding vector, or optionally have the same shape as the action in the case of a higher-rank
  action shape.
  
  Args:
      layers (iter[specification] | iter[iter[specification]]): Layers configuration, see the
          [layers documentation](../modules/layers.html)
          (<span style="color:#C00000"><b>required</b></span>).
      device (string): Device name
          (<span style="color:#00C000"><b>default</b></span>: inherit value of parent module).
      l2_regularization (float >= 0.0): Scalar controlling L2 regularization
          (<span style="color:#00C000"><b>default</b></span>: inherit value of parent module).
      name (string): <span style="color:#0000C0"><b>internal use</b></span>.
      inputs_spec (specification): <span style="color:#0000C0"><b>internal use</b></span>.
      outputs (iter[string]): <span style="color:#0000C0"><b>internal use</b></span>.
code: def _recursive_apply(
      *,
      layer,
      x,
      horizons,
      internals,
      deterministic,
      independent,
      registered_tensors,
      temporal_layer_check,
  ):
      if isinstance(layer, list):
          for layer in layer:
              x, temporal_layer_check = LayeredNetwork._recursive_apply(
                  layer=layer,
                  x=x,
                  horizons=horizons,
                  internals=internals,
                  deterministic=deterministic,
                  independent=independent,
                  registered_tensors=registered_tensors,
                  temporal_layer_check=temporal_layer_check,
              )
  
      elif isinstance(layer, Block):
          for layer in layer.layers:
              x, temporal_layer_check = LayeredNetwork._recursive_apply(
                  layer=layer,
                  x=x,
                  horizons=horizons,
                  internals=internals,
                  deterministic=deterministic,
                  independent=independent,
                  registered_tensors=registered_tensors,
                  temporal_layer_check=temporal_layer_check,
              )
  
      elif isinstance(layer, Reuse):
          x, temporal_layer_check = LayeredNetwork._recursive_apply(
              layer=layer.reused_layer,
              x=x,
              horizons=horizons,
              internals=internals,
              deterministic=deterministic,
              independent=independent,
              registered_tensors=registered_tensors,
              temporal_layer_check=temporal_layer_check,
          )
  
      elif isinstance(layer, Register):
          if layer.tensor in registered_tensors:
              raise TensorforceError.exists(
                  name="registered tensor", value=layer.tensor
              )
          x = layer.apply(x=x)
          registered_tensors[layer.tensor] = x
  
      elif isinstance(layer, MultiInputLayer):
          if layer.tensors not in registered_tensors:
              raise TensorforceError.exists_not(
                  name="registered tensor", value=layer.tensors
              )
          x = layer.apply(x=registered_tensors[layer.tensors])
          temporal_layer_check = False
  
      elif isinstance(layer, NondeterministicLayer):
          x = layer.apply(x=x, deterministic=deterministic)
  
      elif isinstance(layer, StatefulLayer):
          x = layer.apply(x=x, independent=independent)
  
      elif isinstance(layer, TemporalLayer):
          if temporal_layer_check:
              raise TensorforceError(
                  "Multiple successive temporal layers like RNNs are currently not supported."
              )
          x, internals[layer.name] = layer.apply(
              x=x, horizons=horizons, internals=internals[layer.name]
          )
          temporal_layer_check = True
  
      else:
          x = layer.apply(x=x)
  
      return x, temporal_layer_check
  
imports: from collections import Counter
  import tensorflow
  from tensorforce import TensorforceError
  from tensorforce.core import ArrayDict, Module, SignatureDict, TensorDict, TensorSpec, TensorsSpec, tf_function, tf_util
  from tensorforce.core.layers import Block, Layer, layer_modules, MultiInputLayer, NondeterministicLayer, PreprocessingLayer, Register, Reuse, StatefulLayer, TemporalLayer
  from tensorforce.core.parameters import Parameter
label_desc: Use image node_id 6 for calling the LayeredNetwork obj's underlying member method code with example usage: obj._recursive_apply() and returns: x,  temporal_layer_check