class_docstr: Represents an interest rate curve.
docstr: Initializes the interest rate curve.
  
  Args:
    maturity_dates: A `DateTensor` containing the maturity dates on which the
      curve is specified.
    discount_factors: A `Tensor` of real dtype specifying the discount factors
      corresponding to the input maturities. The shape of this input should
      match the shape of `maturity_dates`.
    valuation_date: A scalar `DateTensor` specifying the valuation (or
      settlement) date for the curve.
    interpolator: An instance of `InterpolationMethod`.
      Default value: `None` in which case cubic interpolation is used.
    interpolate_rates: A boolean specifying whether the interpolation should
      be done in discount rates or discount factors space.
      Default value: `True`, i.e., interpolation is done in the discount
      factors space.
    daycount_convention: `DayCountConventions` to use for the interpolation
      purpose.
      Default value: `None` which maps to actual/365 day count convention.
    curve_type: An instance of `CurveTypes` to mark the rate curve.
      Default value: `None` which means that the curve does not have the
        marker.
    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","interest","rate","curve",".","Args",":","maturity_dates",":","A","`","DateTensor","`","containing","the","maturity","dates","on","which","the","curve","is","specified",".","discount_factors",":","A","`","Tensor","`","of","real","dtype","specifying","the","discount","factors","corresponding","to","the","input","maturities",".","The","shape","of","this","input","should","match","the","shape","of","`","maturity_dates","`",".","valuation_date",":","A","scalar","`","DateTensor","`","specifying","the","valuation","(","or","settlement",")","date","for","the","curve",".","interpolator",":","An","instance","of","`","InterpolationMethod","`",".","Default","value",":","`","None","`","in","which","case","cubic","interpolation","is","used",".","interpolate_rates",":","A","boolean","specifying","whether","the","interpolation","should","be","done","in","discount","rates","or","discount","factors","space",".","Default","value",":","`","True","`",",","i.e.",",","interpolation","is","done","in","the","discount","factors","space",".","daycount_convention",":","`","DayCountConventions","`","to","use","for","the","interpolation","purpose",".","Default","value",":","`","None","`","which","maps","to","actual\/365","day","count","convention",".","curve_type",":","An","instance","of","`","CurveTypes","`","to","mark","the","rate","curve",".","Default","value",":","`","None","`","which","means","that","the","curve","does","not","have","the","marker",".","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,
      maturity_dates: types.DateTensor,
      discount_factors: tf.Tensor,
      valuation_date: types.DateTensor,
      interpolator: Optional[_InterpolationMethod] = None,
      interpolate_rates: Optional[bool] = True,
      daycount_convention: Optional[
          _DayCountConventionsProtoType
      ] = None,
      curve_type: Optional[curve_types.CurveType] = None,
      dtype: Optional[tf.DType] = None,
      name: Optional[str] = None,
  ):
      """Initializes the interest rate curve.
  
      Args:
        maturity_dates: A `DateTensor` containing the maturity dates on which the
          curve is specified.
        discount_factors: A `Tensor` of real dtype specifying the discount factors
          corresponding to the input maturities. The shape of this input should
          match the shape of `maturity_dates`.
        valuation_date: A scalar `DateTensor` specifying the valuation (or
          settlement) date for the curve.
        interpolator: An instance of `InterpolationMethod`.
          Default value: `None` in which case cubic interpolation is used.
        interpolate_rates: A boolean specifying whether the interpolation should
          be done in discount rates or discount factors space.
          Default value: `True`, i.e., interpolation is done in the discount
          factors space.
        daycount_convention: `DayCountConventions` to use for the interpolation
          purpose.
          Default value: `None` which maps to actual/365 day count convention.
        curve_type: An instance of `CurveTypes` to mark the rate curve.
          Default value: `None` which means that the curve does not have the
            marker.
        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 "rate_curve"
      with tf.compat.v1.name_scope(self._name):
          self._discount_factor_nodes = tf.convert_to_tensor(
              discount_factors,
              dtype=dtype,
              name="curve_discount_factors",
          )
          self._dtype = dtype or self._discount_factor_nodes.dtype
          if (
              interpolator is None
              or interpolator == _InterpolationMethod.CUBIC
          ):
  
              def cubic_interpolator(xi, x, y):
                  spline_coeffs = math.interpolation.cubic.build_spline(
                      x, y
                  )
                  return math.interpolation.cubic.interpolate(
                      xi, spline_coeffs, dtype=dtype
                  )
  
              interpolator = cubic_interpolator
              self._interpolation_method = _InterpolationMethod.CUBIC
          elif interpolator == _InterpolationMethod.LINEAR:
  
              def linear_interpolator(xi, x, y):
                  return math.interpolation.linear.interpolate(
                      xi, x, y, dtype=dtype
                  )
  
              interpolator = linear_interpolator
              self._interpolation_method = _InterpolationMethod.LINEAR
          elif interpolator == _InterpolationMethod.CONSTANT_FORWARD:
  
              def constant_fwd(xi, x, y):
                  return rates_lib.constant_fwd.interpolate(
                      xi, x, y, dtype=dtype
                  )
  
              interpolator = constant_fwd
              self._interpolation_method = (
                  _InterpolationMethod.CONSTANT_FORWARD
              )
          else:
              raise ValueError(
                  f"Unknown interpolation method {interpolator}."
              )
          self._dates = dateslib.convert_to_date_tensor(maturity_dates)
          self._valuation_date = dateslib.convert_to_date_tensor(
              valuation_date
          )
  
          self._daycount_convention = (
              daycount_convention or _DayCountConventions.ACTUAL_365
          )
          self._day_count_fn = utils.get_daycount_fn(
              self._daycount_convention
          )
          self._times = self._get_time(self._dates)
          self._interpolator = interpolator
          self._interpolate_rates = interpolate_rates
          # Precompute discount rates:
          self._curve_type = curve_type
  
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 1 to create a new RateCurve object from inherited base classes: pmd with example: obj = RateCurve(maturity_dates, discount_factors, valuation_date, interpolator, interpolate_rates, daycount_convention, curve_type, dtype, name)