code: def remove_outer_dims_nest(specs, num_outer_dims):
      """Removes the specified number of outer dimensions from the input spec nest.
  
      Args:
        specs: Nested list/tuple/dict of TensorSpecs/ArraySpecs, describing the
          shape of tensors.
        num_outer_dims: (int) Number of outer dimensions to remove.
  
      Returns:
        Nested TensorSpecs with outer dimensions removed from the input specs.
  
      Raises:
        Value error if a spec in the nest has shape rank less than `num_outer_dims`.
      """
  
      def remove_outer_dims(spec):
          """Removes the num_outer_dims of a tensor spec."""
          # TODO(b/187478998) Use spec.name when tf.SparseTensorSpec supports it.
          name = getattr(spec, "name", None)
          if len(spec.shape) < num_outer_dims:
              raise ValueError(
                  "The shape of spec {} has rank lower than the specified "
                  "num_outer_dims {}".format(spec, num_outer_dims)
              )
          shape = list(spec.shape)[num_outer_dims:]
          if hasattr(spec, "minimum") and hasattr(spec, "maximum"):
              if isinstance(spec.minimum, (tuple, list)) and len(
                  spec.minimum
              ) == len(spec.shape):
                  minimum = spec.minimum[num_outer_dims:]
              else:
                  minimum = spec.minimum
              if isinstance(spec.maximum, (tuple, list)) and len(
                  spec.maximum
              ) == len(spec.shape):
                  maximum = spec.maximum[num_outer_dims:]
              else:
                  maximum = spec.maximum
  
              return BoundedTensorSpec(
                  shape, spec.dtype, minimum, maximum, name
              )
          elif isinstance(spec, 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(remove_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 17 for calling a global function with example usage: remove_outer_dims_nest(specs, num_outer_dims) and returns: tf, TensorSpec, BoundedTensorSpec, tf