class_docstr: Represents a volatility surface.
class_docstr_tok: ["Represents","a","volatility","surface","."]
docstr: Initializes the volatility surface.
  
  Args:
    valuation_date: A `DateTensor` specifying the valuation (or
      settlement) date for the curve.
    expiries: A `DateTensor` containing the expiry dates on which the
      implied volatilities are specified. Should have a compatible shape with
      valuation_date.
    strikes: A `Tensor` of real dtype specifying the strikes corresponding to
      the input maturities. The shape of this input should match the shape of
      `expiries`.
    volatilities: A `Tensor` of real dtype specifying the volatilities
      corresponding to  the input maturities. The shape of this input should
      match the shape of `expiries`.
    daycount_convention: `DayCountConventions` to use for the interpolation
      purpose.
      Default value: `None` which maps to actual/365 day count convention.
    interpolator: An optional Python callable implementing the interpolation
      to be used. The callable should accept two real `Tensor`s specifying
      the strikes and expiry times and should return a real `Tensor` of
      same dtype as the inputs containing the interpolated implied
      volatilities.
      Default value: `None` in which case `Interpolation2D` is used.
    dtype: `tf.Dtype`. Optional input specifying the dtype of the `rates`
      input.
    name: Python str. The name to give to the ops created by this function.
      Default value: `None` which maps to 'rate_curve'.
docstr_tok: ["Initializes","the","volatility","surface",".","Args",":","valuation_date",":","A","`","DateTensor","`","specifying","the","valuation","(","or","settlement",")","date","for","the","curve",".","expiries",":","A","`","DateTensor","`","containing","the","expiry","dates","on","which","the","implied","volatilities","are","specified",".","Should","have","a","compatible","shape","with","valuation_date",".","strikes",":","A","`","Tensor","`","of","real","dtype","specifying","the","strikes","corresponding","to","the","input","maturities",".","The","shape","of","this","input","should","match","the","shape","of","`","expiries","`",".","volatilities",":","A","`","Tensor","`","of","real","dtype","specifying","the","volatilities","corresponding","to","the","input","maturities",".","The","shape","of","this","input","should","match","the","shape","of","`","expiries","`",".","daycount_convention",":","`","DayCountConventions","`","to","use","for","the","interpolation","purpose",".","Default","value",":","`","None","`","which","maps","to","actual\/365","day","count","convention",".","interpolator",":","An","optional","Python","callable","implementing","the","interpolation","to","be","used",".","The","callable","should","accept","two","real","`","Tensor","`","s","specifying","the","strikes","and","expiry","times","and","should","return","a","real","`","Tensor","`","of","same","dtype","as","the","inputs","containing","the","interpolated","implied","volatilities",".","Default","value",":","`","None","`","in","which","case","`","Interpolation2D","`","is","used",".","dtype",":","`","tf.Dtype","`",".","Optional","input","specifying","the","dtype","of","the","`","rates","`","input",".","name",":","Python","str",".","The","name","to","give","to","the","ops","created","by","this","function",".","Default","value",":","`","None","`","which","maps","to","'rate_curve","'","."]
code: def __init__(
      self,
      valuation_date: types.DateTensor,
      expiries: types.DateTensor,
      strikes: types.FloatTensor,
      volatilities: types.FloatTensor,
      daycount_convention: Optional[
          _DayCountConventionsProtoType
      ] = None,
      interpolator: Optional[
          Callable[
              [types.FloatTensor, types.FloatTensor], types.FloatTensor
          ]
      ] = None,
      dtype: Optional[tf.DType] = None,
      name: Optional[str] = None,
  ):
      """Initializes the volatility surface.
  
      Args:
        valuation_date: A `DateTensor` specifying the valuation (or
          settlement) date for the curve.
        expiries: A `DateTensor` containing the expiry dates on which the
          implied volatilities are specified. Should have a compatible shape with
          valuation_date.
        strikes: A `Tensor` of real dtype specifying the strikes corresponding to
          the input maturities. The shape of this input should match the shape of
          `expiries`.
        volatilities: A `Tensor` of real dtype specifying the volatilities
          corresponding to  the input maturities. The shape of this input should
          match the shape of `expiries`.
        daycount_convention: `DayCountConventions` to use for the interpolation
          purpose.
          Default value: `None` which maps to actual/365 day count convention.
        interpolator: An optional Python callable implementing the interpolation
          to be used. The callable should accept two real `Tensor`s specifying
          the strikes and expiry times and should return a real `Tensor` of
          same dtype as the inputs containing the interpolated implied
          volatilities.
          Default value: `None` in which case `Interpolation2D` is used.
        dtype: `tf.Dtype`. Optional input specifying the dtype of the `rates`
          input.
        name: Python str. The name to give to the ops created by this function.
          Default value: `None` which maps to 'rate_curve'.
      """
      self._name = name or "VolatilitySurface"
      self._dtype = dtype or tf.float64
      with tf.name_scope(self._name):
          self._daycount_convention = (
              daycount_convention or _DayCountConventions.ACTUAL_365
          )
          self._day_count_fn = utils.get_daycount_fn(
              self._daycount_convention
          )
          self._valuation_date = dateslib.convert_to_date_tensor(
              valuation_date
          )
          self._expiries = dateslib.convert_to_date_tensor(expiries)
          self._strikes = tf.convert_to_tensor(
              strikes, dtype=self._dtype, name="strikes"
          )
          self._volatilities = tf.convert_to_tensor(
              volatilities, dtype=self._dtype, name="volatilities"
          )
          expiry_times = self._day_count_fn(
              start_date=self._valuation_date,
              end_date=self._expiries,
              dtype=self._dtype,
          )
          if interpolator is None:
              interpolator_obj = interpolation_2d.Interpolation2D(
                  expiry_times, strikes, volatilities, dtype=self._dtype
              )
  
              def interpolator_fn(t, x):
                  return interpolator_obj.interpolate(t, x)
  
              self._interpolator = interpolator_fn
          else:
              self._interpolator = interpolator
  
imports: from typing import Optional, Callable
  import tensorflow.compat.v2
  from tf_quant_finance import datetime
  from tf_quant_finance import math
  from tf_quant_finance.experimental.pricing_platform.framework.core import daycount_conventions
  from tf_quant_finance.experimental.pricing_platform.framework.core import implied_volatility_type
  from tf_quant_finance.experimental.pricing_platform.framework.core import processed_market_data
  from tf_quant_finance.experimental.pricing_platform.framework.core import types
  from tf_quant_finance.experimental.pricing_platform.framework.market_data import utils
label_desc: Use image node_id 1 to create a new VolatilitySurface object from inherited base classes: pmd with example: obj = VolatilitySurface(valuation_date, expiries, strikes, volatilities, daycount_convention, interpolator, dtype, name)