code: def test_with_xla(self):
      @tf.function
      def fn():
          x = tf.constant([[3.0, 4.0], [30.0, 40.0]])
          y = tf.constant([[7.0, 8.0], [70.0, 80.0]])
          alpha = tf.constant(2.0)
          beta = tf.constant(1.0)
          with tf.GradientTape(persistent=True) as tape:
              tape.watch([alpha, beta])
  
              def body(i, state):
                  del i
                  x, y = state
                  return [x * alpha - beta, y * beta + x]
  
              out = for_loop(body, [x, y], [alpha, beta], 3)
          return tape.gradient(out[1], beta)
  
      grad = self.evaluate(tf.xla.experimental.compile(fn))[0]
      self.assertAllEqual(783, grad)
  
file_path: tf-quant-finance/tf_quant_finance/math/custom_loops_test.py
imports: from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  import tf_quant_finance
  from tensorflow.python.framework import test_util
  from tf_quant_finance.math import custom_loops
label_desc: Use image node_id 5 for calling the ForLoopWithCustomGradientTest obj's underlying member method code with example usage: obj.test_with_xla() and returns: tape, list