class_docstr: Represents a volatility surface.
class_docstr_tok: ["Represents","a","volatility","surface","."]
docstr: Returns the interpolated volatility on a specified set of expiries.
  
  Args:
    strike: The strikes for which the interpolation is desired.
    expiry_dates: Optional input specifying the expiry dates for which
      interpolation is desired. The user should supply either `expiry_dates`
      or `expiry_times` for interpolation.
    expiry_times: Optional real `Tensor` containing the time to expiration
      for which interpolation is desired. The user should supply either
      `expiry_dates` or `expiry_times` for interpolation.
    term: Optional input specifying the term of the underlying rate for
      which the interpolation is desired. Relevant for interest rate implied
      volatility data.
  
  Returns:
    A `Tensor` of the same shape as `expiry` with the interpolated volatility
    from the volatility surface.
  
  Raises:
    ValueError is both `expiry_dates` and `expiry_times`  are specified.
docstr_tok: ["Returns","the","interpolated","volatility","on","a","specified","set","of","expiries",".","Args",":","strike",":","The","strikes","for","which","the","interpolation","is","desired",".","expiry_dates",":","Optional","input","specifying","the","expiry","dates","for","which","interpolation","is","desired",".","The","user","should","supply","either","`","expiry_dates","`","or","`","expiry_times","`","for","interpolation",".","expiry_times",":","Optional","real","`","Tensor","`","containing","the","time","to","expiration","for","which","interpolation","is","desired",".","The","user","should","supply","either","`","expiry_dates","`","or","`","expiry_times","`","for","interpolation",".","term",":","Optional","input","specifying","the","term","of","the","underlying","rate","for","which","the","interpolation","is","desired",".","Relevant","for","interest","rate","implied","volatility","data",".","Returns",":","A","`","Tensor","`","of","the","same","shape","as","`","expiry","`","with","the","interpolated","volatility","from","the","volatility","surface",".","Raises",":","ValueError","is","both","`","expiry_dates","`","and","`","expiry_times","`","are","specified","."]
code: def volatility(
      self,
      strike: types.FloatTensor,
      expiry_dates: Optional[types.DateTensor] = None,
      expiry_times: Optional[types.FloatTensor] = None,
      term: Optional[types.Period] = None,
  ) -> types.FloatTensor:
      """Returns the interpolated volatility on a specified set of expiries.
  
      Args:
        strike: The strikes for which the interpolation is desired.
        expiry_dates: Optional input specifying the expiry dates for which
          interpolation is desired. The user should supply either `expiry_dates`
          or `expiry_times` for interpolation.
        expiry_times: Optional real `Tensor` containing the time to expiration
          for which interpolation is desired. The user should supply either
          `expiry_dates` or `expiry_times` for interpolation.
        term: Optional input specifying the term of the underlying rate for
          which the interpolation is desired. Relevant for interest rate implied
          volatility data.
  
      Returns:
        A `Tensor` of the same shape as `expiry` with the interpolated volatility
        from the volatility surface.
  
      Raises:
        ValueError is both `expiry_dates` and `expiry_times`  are specified.
      """
      del term
      if expiry_dates is not None and expiry_times is not None:
          raise ValueError(
              "Unexpected inputs: Both expiry_dates and expiry times "
              "are specified"
          )
  
      if expiry_times is None:
          expiry_dates = dateslib.convert_to_date_tensor(expiry_dates)
          expiries = self._day_count_fn(
              start_date=self._valuation_date,
              end_date=expiry_dates,
              dtype=self._dtype,
          )
      else:
          expiries = tf.convert_to_tensor(
              expiry_times, dtype=self._dtype
          )
      strike = tf.convert_to_tensor(
          strike, dtype=self._dtype, name="strike"
      )
      return self._interpolator(expiries, strike)
  
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 2 for calling the VolatilitySurface obj's underlying member method code with example usage: obj.volatility(strike, expiry_dates, expiry_times, term) and returns: self