code: def test_forward_gradient(self):
      t = tf.range(1, 3, dtype=tf.float32)  # Shape [2]
      func = lambda t: tf.stack(
          [t, t**2, t**3], axis=0
      )  # Shape [3, 2]
      with self.subTest("EagerExecution"):
          fwd_grad = self.evaluate(tff.math.fwd_gradient(func, t))
          self.assertEqual(fwd_grad.shape, (3, 2))
          np.testing.assert_allclose(
              fwd_grad, [[1.0, 1.0], [2.0, 4.0], [3.0, 12.0]]
          )
      with self.subTest("GraphExecution"):
  
          @tf.function
          def grad_computation():
              y = func(t)
              return tff.math.fwd_gradient(y, t)
  
          fwd_grad = self.evaluate(grad_computation())
          self.assertEqual(fwd_grad.shape, (3, 2))
          np.testing.assert_allclose(
              fwd_grad, [[1.0, 1.0], [2.0, 4.0], [3.0, 12.0]]
          )
  
file_path: tf-quant-finance/tf_quant_finance/math/gradient_test.py
imports: import numpy
  import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 1 for calling the GradientTest obj's underlying member method code with example usage: obj.test_forward_gradient() and returns: tff