code: def build_volatility_surface(
      val_date, expiry_times, expiries, strikes, iv, dtype
  ):
      interpolator = (
          tff.math.interpolation.interpolation_2d.Interpolation2D(
              expiry_times, strikes, iv, dtype=dtype
          )
      )
  
      def _interpolator(t, x):
          x_transposed = tf.transpose(x)
          t = tf.broadcast_to(t, x_transposed.shape)
          return tf.transpose(interpolator.interpolate(t, x_transposed))
  
      return volatility_surface.VolatilitySurface(
          val_date,
          expiries,
          strikes,
          iv,
          interpolator=_interpolator,
          dtype=dtype,
      )
  
file_path: tf-quant-finance/tf_quant_finance/experimental/local_stochastic_volatility/local_stochastic_volatility_model_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 a global function with example usage: build_volatility_surface(val_date, expiry_times, expiries, strikes, iv, dtype) and returns: volatility_surface, tf