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_parameter_broadcasting(self):
      equiv_vol = tff.models.sabr.approximations.implied_volatility(
          strikes=np.array(
              [
                  [105.0, 110.0, 115.0, 120.0, 125.0],
                  [105.0, 110.0, 115.0, 120.0, 125.0],
                  [105.0, 110.0, 115.0, 120.0, 125.0],
              ]
          ),
          expiries=np.array(
              [
                  [30.0 / 365.0],
                  [60.0 / 365.0],
                  [90.0 / 365.0],
              ]
          ),
          forwards=115.0,
          alpha=np.array(
              [
                  [1.00],
                  [1.50],
                  [2.00],
              ]
          ),
          beta=np.array(
              [
                  [0.25],
                  [0.50],
                  [0.75],
              ]
          ),
          rho=0.05,
          volvol=np.array(
              [
                  [2.0],
                  [2.5],
                  [3.0],
              ]
          ),
          dtype=tf.float64,
      )
      equiv_vol = self.evaluate(equiv_vol)
  
      self.assertAllClose(
          equiv_vol,
          [
              [
                  # These correspond to:
                  # strikes=[105.0, 110.0, 115.0, 120.0, 125.0],
                  # For expiries=30.0/365.0, forwards=115.0, alpha=1.0, beta=0.25,
                  # rho=0.05, and volvol=2.0.
                  0.07290126718857293,
                  0.048678694833488044,
                  0.02925354052258421,
                  0.048663433935318724,
                  0.06968554457600247,
              ],
              [
                  # These correspond to:
                  # strikes=[105.0, 110.0, 115.0, 120.0, 125.0],
                  # For expiries=60.0/365.0, forwards=115.0, alpha=1.5, beta=0.5,
                  # rho=0.05, and volvol=2.5.
                  0.19479147227269086,
                  0.1647194927224411,
                  0.15186141282688834,
                  0.16548343518393138,
                  0.19098676373872667,
              ],
              [
                  # These correspond to:
                  # strikes=[105.0, 110.0, 115.0, 120.0, 125.0],
                  # For expiries=90.0/365.0, forwards=115.0, alpha=2.0, beta=0.75,
                  # rho=0.05, and volvol=3.0.
                  0.7493941577599591,
                  0.7318045979333434,
                  0.7259931664225101,
                  0.7310817574988578,
                  0.7449168095317619,
              ],
          ],
      )
  
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 2 for calling the SabrApproximationImpliedVolatilityTest obj's underlying member method code with example usage: obj.test_implied_volatility_parameter_broadcasting() without return types