docstr: Test the gradients of the samples w.r.t. `df` and `skewness`.
docstr_tok: ["Test","the","gradients","of","the","samples","w.r.t",".","`","df","`","and","`","skewness","`","."]
code: def testDifferentiableSample(self):
      """Test the gradients of the samples w.r.t. `df` and `skewness`."""
      if tf.executing_eagerly() and not JAX_MODE:
          self.skipTest("Too slow for eager execution.")
      seed = test_util.test_seed(sampler_type="stateless")
  
      df = tf.constant(5.0, self.dtype)
      skewness = tf.constant(2.0, self.dtype)
  
      @tf.function(autograph=False)
      def get_abs_sample_mean(df, skewness):
          loc = tf.constant(0.0, self.dtype)
          scale = tf.constant(1.0, self.dtype)
          dist = two_piece_student_t.TwoPieceStudentT(
              df=df,
              loc=loc,
              scale=scale,
              skewness=skewness,
              validate_args=True,
          )
          return tf.reduce_mean(
              tf.abs(dist.sample(int(1e6), seed=seed)), axis=0
          )
  
      err = self.compute_max_gradient_error(
          lambda _df: get_abs_sample_mean(_df, skewness),
          [df],
          delta=1e-4,
      )
      self.assertLess(err, 2e-1)
  
      err = self.compute_max_gradient_error(
          lambda _skewness: get_abs_sample_mean(df, _skewness),
          [skewness],
          delta=5e-2,
      )
      self.assertLess(err, 2e-1)
  
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import two_piece_student_t
  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 _TwoPieceStudentTTest obj's underlying member method code with example usage: obj.testDifferentiableSample() and returns: tf