code: def test_grad_log_prob_unsafe_val(self):
      def f(loc):
          d = independent.Independent(
              masked.Masked(
                  lognormal.LogNormal(loc, 1), [True, False, False]
              ),
              reinterpreted_batch_ndims=1,
          )
          return d.log_prob([1.1, 0.0, float("nan")])
  
      self.assertAllFinite(
          gradient.value_and_gradient(f, tf.ones([3]))[1]
      )
  
imports: import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import distribution
  from tensorflow_probability.python.distributions import gamma
  from tensorflow_probability.python.distributions import independent
  from tensorflow_probability.python.distributions import kullback_leibler
  from tensorflow_probability.python.distributions import log_prob_ratio
  from tensorflow_probability.python.distributions import lognormal
  from tensorflow_probability.python.distributions import masked
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import relaxed_onehot_categorical
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 10 for calling the MaskedTest obj's underlying member method code with example usage: obj.test_grad_log_prob_unsafe_val() and returns: d