code: def safe_signed_div(
      a: type_alias.TensorLike,
      b: type_alias.TensorLike,
      eps: Optional[type_alias.Float] = None,
      name: str = "safe_signed_div",
  ) -> tf.Tensor:
      """Calculates a/b safely.
  
      If the tf-graphics debug flag is set to `True`, this function adds assertions
      to the graph that check whether `abs(b + eps)` is greather than zero, and the
      division has no `NaN` or `Inf` values.
  
      Note:
        In the following, A1 to An are optional batch dimensions, which must be
        broadcast compatible.
  
      Args:
        a: A `float` or a tensor of shape `[A1, ..., An]`, which is the nominator.
        b: A `float` or a tensor of shape `[A1, ..., An]`, which is the denominator
          with non-negative values.
        eps: A small `float`, to be added to the denominator. If left `None`, its
          value is automatically selected using `b.dtype`.
        name: A name for this op. Defaults to 'safe_signed_div'.
  
      Raises:
         InvalidArgumentError: If tf-graphics debug flag is set and the division
           causes `NaN` or `Inf` values.
  
      Returns:
         A tensor of shape `[A1, ..., An]` containing the results of division.
      """
      with tf.name_scope(name):
          a = tf.convert_to_tensor(value=a)
          b = tf.convert_to_tensor(value=b)
          if eps is None:
              eps = asserts.select_eps_for_division(b.dtype)
          eps = tf.convert_to_tensor(value=eps, dtype=b.dtype)
  
          return asserts.assert_no_infs_or_nans(
              a / (b + nonzero_sign(b) * eps)
          )
  
file_path: graphics/tensorflow_graphics/util/safe_ops.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from typing import Optional
  import numpy
  import tensorflow
  from tensorflow_graphics.util import asserts
  from tensorflow_graphics.util import type_alias
label_desc: Use image node_id 4 for calling a global function with example usage: safe_signed_div(a, b, eps, name) and returns: asserts