code: def split_nested_tensors(tensors, specs, num_or_size_splits):
      """Split batched nested tensors, on batch dim (outer dim), into a list.
  
      Args:
        tensors: Nested list/tuple or dict of batched Tensors.
        specs: Nested list/tuple or dict of TensorSpecs, describing the shape of the
          non-batched Tensors.
        num_or_size_splits: Same as argument for tf.split. Either a python integer
          indicating the number of splits along batch_dim or a list of integer
          Tensors containing the sizes of each output tensor along batch_dim. If a
          scalar then it must evenly divide value.shape[axis]; otherwise the sum of
          sizes along the split dimension must match that of the value. For
          `SparseTensor` inputs, `num_or_size_splits` must be the scalar `num_split`
          (see documentation of `tf.sparse.split` for more details).
  
      Returns:
        A list of nested non-batched version of each tensor, where each list item
          corresponds to one batch item.
      Raises:
        ValueError: if the tensors and specs have incompatible dimensions or shapes.
        ValueError: if a non-scalar is passed and there are SparseTensors in the
          structure.
      """
      split_tensor_lists = []
      (
          flat_tensors,
          flat_shapes,
      ) = _flatten_and_check_shape_nested_tensors(tensors, specs)
      for tensor, shape in zip(flat_tensors, flat_shapes):
          if tensor.shape.rank == shape.rank:
              raise ValueError(
                  "Can only split tensors with a batch dimension."
              )
          if tensor.shape.rank == shape.rank + 1:
              if isinstance(tensor, tf.SparseTensor):
                  if not isinstance(num_or_size_splits, numbers.Number):
                      raise ValueError(
                          "Saw a SparseTensor, for which num_or_size_splits must be a "
                          "scalar.  But it is not: {}".format(
                              num_or_size_splits
                          )
                      )
                  split_tensors = tf.sparse.split(
                      sp_input=tensor,
                      num_split=num_or_size_splits,
                      axis=0,
                  )
              else:
                  split_tensors = tf.split(tensor, num_or_size_splits)
          split_tensor_lists.append(split_tensors)
      split_tensors_zipped = zip(*split_tensor_lists)
      return [
          tf.nest.pack_sequence_as(tensors, zipped)
          for zipped in split_tensors_zipped
      ]
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import numbers
  from typing import Optional, Text
  from absl import logging
  import numpy
  from six.moves import zip
  import tensorflow
  from tf_agents.typing import types
  from tf_agents.utils import composite
  import wrapt
  from tensorflow.python.util import nest
label_desc: Use image node_id 18 for calling a global function with example usage: split_nested_tensors(tensors, specs, num_or_size_splits) and returns: unknown