code: def _get_dim(tensor, axis):
      """Returns dimensionality of a tensor for a given axis."""
      return tf.compat.dimension_value(tensor.shape[axis])
  
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 6 for calling a global function with example usage: _get_dim(tensor, axis) and returns: tf