code: def testGradientsNx(self, dtype, fn_name):
      loc = dtype(0.1)
      scale = dtype(3.0)
      low = dtype(-10.0)
      high = dtype(5.0)
  
      def f(loc, scale):
          dist = truncated_normal.TruncatedNormal(
              loc=loc,
              scale=scale,
              low=low,
              high=high,
              validate_args=True,
          )
          func = getattr(dist, fn_name)
          return func()
  
      if fn_name not in ["mode"]:
          err = self.compute_max_gradient_error(f, [loc, scale])
          self.assertLess(err, 0.005)
      else:
          err = self.compute_max_gradient_error(
              lambda x: f(x, scale), [loc]
          )
          self.assertLess(err, 0.005)
  
imports: import itertools
  import unittest
  from absl.testing import parameterized
  import numpy
  from scipy import stats
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.distributions import truncated_normal
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 18 for calling the TruncatedNormalStandaloneTestCase obj's underlying member method code with example usage: obj.testGradientsNx(dtype, fn_name) and returns: func