docstr: Tests that gradient calculation correctly handles underlow.
docstr_tok: ["Tests","that","gradient","calculation","correctly","handles","underlow","."]
code: def test_log_soomean_exp_gradient_using_finite_difference_3(self):
      """Tests that gradient calculation correctly handles underlow."""
  
      delta = 1e-3
      logx_ = np.float32([0.0, -1000, -1, 1])
      logx = tf.constant(logx_)
  
      [
          np_grad_log_soomean_u,
          np_grad_log_mean_u,
      ] = self._numpy_grad_log_soomean_exp(logx_, axis=0, delta=delta)
  
      _, grad_log_soomean_u = self.evaluate(
          gradient.value_and_gradient(
              lambda logx: leave_one_out.log_soomean_exp(logx, axis=0)[
                  0
              ],
              logx,
          )
      )
  
      _, grad_log_mean_u = self.evaluate(
          gradient.value_and_gradient(
              lambda logx: leave_one_out.log_soomean_exp(logx, axis=0)[
                  1
              ],
              logx,
          )
      )
  
      self.assertAllClose(
          np_grad_log_mean_u, grad_log_mean_u, rtol=delta, atol=delta
      )
      self.assertAllClose(
          np_grad_log_soomean_u,
          grad_log_soomean_u,
          rtol=delta,
          atol=delta,
      )
      # Verify claim in docstring.
      self.assertAllClose(
          np.ones_like(grad_log_mean_u.sum(axis=0)),
          grad_log_mean_u.sum(axis=0),
      )
      self.assertAllClose(
          np.ones_like(grad_log_soomean_u.mean(axis=0)),
          grad_log_soomean_u.mean(axis=0),
      )
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.stats import leave_one_out
label_desc: Use image node_id 10 for calling the LogSooMeanTest obj's underlying member method code with example usage: obj.test_log_soomean_exp_gradient_using_finite_difference_3() without return types