class_docstr: Represents an interest rate curve.
docstr: Returns discount factors at `interpolation_dates`.
docstr_tok: ["Returns","discount","factors","at","`","interpolation_dates","`","."]
code: def discount_factor(
      self,
      interpolation_dates: Optional[types.DateTensor] = None,
      interpolation_times: Optional[types.FloatTensor] = None,
      name: Optional[str] = None,
  ):
      """Returns discount factors at `interpolation_dates`."""
  
      if interpolation_dates is None and interpolation_times is None:
          raise ValueError(
              "Either interpolation_dates or interpolation times "
              "must be supplied."
          )
      if interpolation_dates is not None:
          interpolation_dates = dateslib.convert_to_date_tensor(
              interpolation_dates
          )
          times = self._get_time(interpolation_dates)
      else:
          times = tf.convert_to_tensor(interpolation_times, self._dtype)
      if self._interpolate_rates:
          rates = self._interpolator(
              times, self._times, self.discount_rate_nodes
          )
          discount_factor = tf.math.exp(-rates * times)
      else:
          discount_factor = self._interpolator(
              times, self._times, self.discount_factor_nodes
          )
      return tf.identity(
          discount_factor, name=name or "discount_factor"
      )
  
imports: from typing import Optional, Tuple
  import tensorflow.compat.v2
  from tf_quant_finance import datetime
  from tf_quant_finance import math
  from tf_quant_finance import rates
  from tf_quant_finance.experimental.pricing_platform.framework.core import curve_types
  from tf_quant_finance.experimental.pricing_platform.framework.core import daycount_conventions
  from tf_quant_finance.experimental.pricing_platform.framework.core import interpolation_method
  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 9 for calling the RateCurve obj's underlying member method code with example usage: obj.discount_factor(interpolation_dates, interpolation_times, name) and returns: tf