code: def get_outer_array_shape(nested_array, spec):
      """Batch dims of array's batch dimension `dim`."""
      first_array = tf.nest.flatten(nested_array)[0]
      first_spec = tf.nest.flatten(spec)[0]
      num_outer_dims = len(first_array.shape) - len(first_spec.shape)
      return first_array.shape[:num_outer_dims]
  
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 31 for calling a global function with example usage: get_outer_array_shape(nested_array, spec) and returns: first_array