code: def check_nested_index_points(kernel, index_points):
      """Ensures that the example dimensions are the same or broadcastable."""
      num_index_points = tf.nest.map_structure(
          lambda x, nd: tf.compat.dimension_value(x.shape[-(nd + 1)]),
          index_points,
          kernel.feature_ndims,
      )
      flat_num_index_points = tf.nest.flatten(num_index_points)
      static_non_singleton_num_points = set(
          n for n in flat_num_index_points if n is not None and n != 1
      )
      if len(static_non_singleton_num_points) > 1:
          raise ValueError(
              "Nested components of `index_points` must contain the same or "
              "broadcastable numbers of examples. Saw components with "
              f'{", ".join(list(str(n) for n in static_non_singleton_num_points))} '
              "examples."
          )
  
file_path: probability/tensorflow_probability/python/distributions/internal/stochastic_process_util.py
imports: import functools
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.math.psd_kernels.internal import util
  from tensorflow.python.util import nest
label_desc: Use image node_id 3 for calling a global function with example usage: check_nested_index_points(kernel, index_points) without return types