code: def add_outer_dims_nest(specs, outer_dims):
      """Adds outer dimensions to the shape of input specs.
  
      Args:
        specs: Nested list/tuple/dict of TensorSpecs/ArraySpecs, describing the
          shape of tensors.
        outer_dims: a list or tuple, representing the outer shape to be added to the
          TensorSpecs in specs.
  
      Returns:
        Nested TensorSpecs with outer dimensions added to the shape of input specs.
  
      Raises:
        ValueError: if any outer_dims is neither a list nor tuple.
      """
      if not isinstance(outer_dims, (tuple, list)):
          raise ValueError(
              "outer_dims must be a tuple or list of dimensions"
          )
  
      def add_outer_dims(spec):
          # TODO(b/187478998) Use spec.name when tf.SparseTensorSpec supports it.
          name = getattr(spec, "name", None)
          shape = outer_dims + spec.shape
          if hasattr(spec, "minimum") and hasattr(spec, "maximum"):
              return BoundedTensorSpec(
                  shape, spec.dtype, spec.minimum, spec.maximum, name
              )
          elif isinstance(specs, tf.SparseTensorSpec):
              # TODO(b/187478998) Add name when tf.SparseTensorSpec supports it.
              return tf.SparseTensorSpec(shape, spec.dtype)
          return TensorSpec(shape, spec.dtype, name=name)
  
      return tf.nest.map_structure(add_outer_dims, specs)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from typing import Union
  import numpy
  import tensorflow
  import tensorflow_probability
  from tf_agents.specs import array_spec
  from tf_agents.typing import types
  from google.protobuf import text_format
  from tensorflow.core.protobuf import struct_pb2
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.saved_model import nested_structure_coder
label_desc: Use image node_id 14 for calling a global function with example usage: add_outer_dims_nest(specs, outer_dims) and returns: tf, TensorSpec, BoundedTensorSpec, tf