code: def assert_nonzero_norm(
      vector: type_alias.TensorLike,
      eps: Optional[type_alias.Float] = None,
      name: str = "assert_nonzero_norm",
  ) -> tf.Tensor:
      """Checks whether vector/quaternion has non-zero norm in its last dimension.
  
      This function checks whether all the norms of the vectors are greater than
      eps, such that normalizing them will not generate NaN values. Normalization is
      assumed to be done in the last dimension of vector. If eps is left as `None`,
      the function will determine the most suitable value depending on the `dtype`
      of the `vector`.
  
      Note:
        In the following, A1 to An are optional batch dimensions.
  
      Args:
        vector: A tensor of shape `[A1, ..., An, V]`, where the last dimension
          contains a V dimensional vector.
        eps: A `float` describing the tolerance used to determine if the norm is
          equal to zero.
        name: A name for this op. Defaults to 'assert_nonzero_norm'.
  
      Raises:
        InvalidArgumentError: If `vector` has zero norm.
  
      Returns:
        The input vector, with dependence on the assertion operator in the graph.
      """
      if not FLAGS[tfg_flags.TFG_ADD_ASSERTS_TO_GRAPH].value:
          return vector
  
      with tf.name_scope(name):
          vector = tf.convert_to_tensor(value=vector)
          if eps is None:
              eps = select_eps_for_division(vector.dtype)
          eps = tf.convert_to_tensor(value=eps, dtype=vector.dtype)
  
          norm = tf.norm(tensor=vector, axis=-1)
          with tf.control_dependencies(
              [tf.debugging.assert_greater(norm, eps)]
          ):
              return tf.identity(vector)
  
file_path: graphics/tensorflow_graphics/util/asserts.py
imports: from typing import Optional
  from absl import flags
  import numpy
  import tensorflow
  from tensorflow_graphics.util import tfg_flags
  from tensorflow_graphics.util import type_alias
label_desc: Use image node_id 5 for calling a global function with example usage: assert_nonzero_norm(vector, eps, name) and returns: vector, tf