code: def compare_dimensions(
      tensors: Union[List[tf.Tensor], Tuple[tf.Tensor]],
      axes: Union[int, List[int], Tuple[int]],
      tensor_names: Optional[Union[List[str], Tuple[str]]] = None,
  ) -> None:
      """Compares dimensions of tensors with static or dynamic shapes.
  
      Args:
        tensors: A list or tuple of tensors to compare.
        axes: An `int` or a list or tuple of `int`s with the same length as
          `tensors`. If an `int`, it is assumed to be the same for all the tensors.
          Each entry should correspond to the axis of the tensor being compared.
        tensor_names: Names of `tensors` to be used in the error message if one is
          thrown. If left as `None`, their `Tensor.name` fields are used instead.
  
      Raises:
        ValueError: If inputs have unexpected types, or if given axes are out of
          bounds, or if the check fails.
      """
      _check_tensors(tensors, "tensors")
      if isinstance(axes, int):
          axes = [axes] * len(tensors)
      _check_tensor_axis_lists(tensors, "tensors", axes, "axes")
      axes = _fix_axes(tensors, axes, allow_negative=False)
      if tensor_names is None:
          tensor_names = _give_default_names(tensors, "tensor")
      dimensions = [
          _get_dim(tensor, axis) for tensor, axis in zip(tensors, axes)
      ]
      if not _all_are_equal(dimensions):
          raise ValueError(
              "Tensors {} must have the same number of dimensions in "
              "axes {}, but they are {}.".format(
                  list(tensor_names), list(axes), list(dimensions)
              )
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import itertools
  from typing import Any, List, Optional, Tuple, Union
  import numpy
  import six
  from six.moves import range
  from six.moves import zip
  import tensorflow
label_desc: Use image node_id 15 for calling a global function with example usage: compare_dimensions(tensors, axes, tensor_names) without return types