code: def verify_tensor_all_finite_v2(x, message, name=None):
      """Assert that the tensor does not contain any NaN's or Inf's.
  
      >>> @tf.function
      ... def f(x):
      ...   x = tf.debugging.assert_all_finite(x, 'Input x must be all finite')
      ...   return x + 1
  
      >>> f(tf.constant([np.inf, 1, 2]))
      Traceback (most recent call last):
         ...
      InvalidArgumentError: ...
  
      Args:
        x: Tensor to check.
        message: Message to log on failure.
        name: A name for this operation (optional).
  
      Returns:
        Same tensor as `x`.
      """
      with ops.name_scope(name, "VerifyFinite", [x]) as name:
          x = ops.convert_to_tensor(x, name="x")
          with ops.colocate_with(x):
              verify_input = array_ops.check_numerics(
                  x, message=message
              )
              out = control_flow_ops.with_dependencies(
                  [verify_input], x
              )
      return out
  
file_path: tensorflow/tensorflow/python/ops/numerics.py
imports: from tensorflow.python.eager import context
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.util import deprecation
  from tensorflow.python.util import dispatch
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 2 for calling a global function with example usage: verify_tensor_all_finite_v2(x, message, name) and returns: out