class_docstr: Test for cases in which enable_check_numerics() catches infs or nans.
class_docstr_tok: ["Test","for","cases","in","which","enable_check_numerics","(",")","catches","infs","or","nans","."]
docstr: Test catching infinites generated in a FuncGraph.
docstr_tok: ["Test","catching","infinites","generated","in","a","FuncGraph","."]
code: def testCatchFunctionOpInfFloat64(self):
      """Test catching infinites generated in a FuncGraph."""
  
      check_numerics_callback.enable_check_numerics()
  
      @def_function.function
      def divide_sum_with_diff(x, y):
          w1 = x + y
          w2 = x - y
          u = w1 / w2
          return u * 2.0
  
      x = constant_op.constant(2.0, dtype=dtypes.float64)
      y = constant_op.constant(2.0, dtype=dtypes.float64)
      message = self._assertRaisesInvalidArgumentErrorAndGetMessage(
          lambda: self.evaluate(divide_sum_with_diff(x, y))
      )
  
      # Check the content of the error message.
      self.assertTrue(re.search(r"graph op.*\"RealDiv\"", message))
      self.assertTrue(re.search(r"dtype.*float64", message))
      self.assertIn("shape: ()\n", message)
      self.assertIn("Input tensors (2):", message)
      # Check that the correct input ops are printed.
      self.assertTrue(re.search(r"0:.*Tensor.*add:0", message))
      self.assertTrue(re.search(r"1:.*Tensor.*sub:0", message))
      # Check that the correct line for op creation is printed.
      self.assertTrue(
          re.search(r"Stack trace of op's creation", message)
      )
      self.assertIn("divide_sum_with_diff", message)
  
imports: import re
  import numpy
  from tensorflow.python.data.ops import dataset_ops
  from tensorflow.python.debug.lib import check_numerics_callback
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_grad
  from tensorflow.python.ops import custom_gradient
  from tensorflow.python.ops import gen_nn_ops
  from tensorflow.python.ops import gradient_checker_v2
  from tensorflow.python.ops import math_grad
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import googletest
  from tensorflow.python.platform import test
label_desc: Use image node_id 7 for calling the CheckNumericsCallbackUnhealthyTest obj's underlying member method code with example usage: obj.testCatchFunctionOpInfFloat64() and returns: unknown