docstr: Finite difference approximation of `grad(csiszar_vimco_helper, logx)`.
docstr_tok: ["Finite","difference","approximation","of","`","grad","(","csiszar_vimco_helper",",","logx",")","`","."]
code: def _numpy_grad_log_soomean_exp(self, logx, axis, delta):
      """Finite difference approximation of `grad(csiszar_vimco_helper, logx)`."""
      if axis != 0:
          raise NotImplementedError(
              "Currently only `axis=0` is supported."
          )
      flatten, unflatten = self._make_flatteners(logx.shape, axis=axis)
      logx = flatten(logx)
      # This code actually estimates the sum of the Jacobian because that's what
      # TF's gradient calculation does.
      (
          np_log_soomean_u1,
          np_log_mean_u1,
      ) = self._numpy_log_soomean_exp_impl(
          logx[..., np.newaxis] + np.diag([delta] * len(logx)), axis=0
      )
      (
          np_log_soomean_u,
          np_log_mean_u,
      ) = self._numpy_log_soomean_exp_impl(
          logx[..., np.newaxis], axis=0
      )
      grad_log_soomean_u = (
          np.sum(np_log_soomean_u1 - np_log_soomean_u, axis=0) / delta
      )
      grad_log_mean_u = (np_log_mean_u1 - np_log_mean_u) / delta
      # TODO(jvdillon): We're not actually unflattening correctly so if we want to
      # check the grad when axis!=0, we need to fix this logic.
      grad_log_soomean_u = unflatten(grad_log_soomean_u)
      return grad_log_soomean_u, grad_log_mean_u
  
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 4 for calling the LogSooMeanTest obj's underlying member method code with example usage: obj._numpy_grad_log_soomean_exp(logx, axis, delta) and returns: grad_log_soomean_u,  grad_log_mean_u