class_docstr: Tests for the SABR approximations to implied volatility.
class_docstr_tok: ["Tests","for","the","SABR","approximations","to","implied","volatility","."]
code: def test_implied_volatility_differentiable(
      self,
      strikes,
      forwards,
      expiries,
      alpha,
      beta,
      volvol,
      rho,
      vol_type,
      dtype,
  ):
      forwards = tf.convert_to_tensor(forwards, dtype=dtype)
      strikes = tf.convert_to_tensor(strikes, dtype=dtype)
      expiries = tf.convert_to_tensor(expiries, dtype=dtype)
      alpha = tf.convert_to_tensor(alpha, dtype=dtype)
      beta = tf.convert_to_tensor(beta, dtype=dtype)
      rho = tf.convert_to_tensor(rho, dtype=dtype)
      volvol = tf.convert_to_tensor(volvol, dtype=dtype)
  
      with tf.GradientTape(persistent=True) as tape:
          tape.watch(
              [forwards, strikes, expiries, alpha, beta, rho, volvol]
          )
          equiv_vol = tff.models.sabr.approximations.implied_volatility(
              forwards=forwards,
              strikes=strikes,
              expiries=expiries,
              alpha=alpha,
              beta=beta,
              rho=rho,
              volvol=volvol,
              volatility_type=vol_type,
              dtype=dtype,
          )
          grad = tape.gradient(
              target=equiv_vol,
              sources=[
                  forwards,
                  strikes,
                  expiries,
                  alpha,
                  beta,
                  rho,
                  volvol,
              ],
          )
  
      grad = self.evaluate(grad)
      self.assertTrue(all(np.all(np.isfinite(x)) for x in grad))
  
file_path: tf-quant-finance/tf_quant_finance/models/sabr/approximations/implied_volatility_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
label_desc: Use image node_id 5 for calling the SabrApproximationImpliedVolatilityTest obj's underlying member method code with example usage: obj.test_implied_volatility_differentiable(strikes, forwards, expiries, alpha, beta, volvol, rho, vol_type, dtype) without return types