docstr: Tests that the diffs op is differentiable.
docstr_tok: ["Tests","that","the","diffs","op","is","differentiable","."]
code: def test_diffs_differentiable(self):
      """Tests that the diffs op is differentiable."""
      x = tf.constant(2.0)
      xv = tf.stack([x, x * x, x * x * x], axis=0)
  
      # Produces [x, x^2 - x, x^3 - x^2]
      dxv = self.evaluate(math.diff(xv))
      np.testing.assert_array_equal(dxv, [2.0, 2.0, 4.0])
  
      grad = self.evaluate(tf.gradients(math.diff(xv), x)[0])
      # Note that TF gradients adds up the components of the jacobian.
      # The sum of [1, 2x-1, 3x^2-2x] at x = 2 is 12.
      self.assertEqual(grad, 12.0)
  
file_path: tf-quant-finance/tf_quant_finance/math/diff_ops_test.py
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tf_quant_finance import math
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 2 for calling the DiffOpsTest obj's underlying member method code with example usage: obj.test_diffs_differentiable() without return types