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_docstring_example(self):
      equiv_vol = tff.models.sabr.approximations.implied_volatility(
          forwards=np.array([120.0, 20.0]),
          strikes=np.array([106.0, 11.0]),
          expiries=np.array([17.0 / 365.0, 400.0 / 365.0]),
          alpha=1.63,
          beta=0.6,
          rho=0.00002,
          volvol=3.3,
          dtype=tf.float64,
      )
      equiv_vol = self.evaluate(equiv_vol)
  
      # Answer obtained by the equivalent formulation in QuantLib, e.g.:
      #
      # ```
      # import QuantLib as ql
      #
      # print(
      #   ql.sabrVolatility(
      #     strike=106.0, forward=120.0, expiryTime=17.0/365.0,
      #     alpha=1.63, beta=0.6, volvol=3.3, rho=0.0002
      #   ))
      # ```
      self.assertAllClose(
          equiv_vol, [0.33284656705268817, 1.9828728139982792]
      )
  
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 1 for calling the SabrApproximationImpliedVolatilityTest obj's underlying member method code with example usage: obj.test_implied_volatility_docstring_example() without return types