class_docstr: Represents an interest rate curve.
docstr: Returns the simply accrued forward rate between [start_dt, maturity_dt].
  
  Args:
    start_date: A `DateTensor` specifying the start of the accrual period
      for the forward rate. The function expects either `start_date` or
      `start_time` to be specified.
    maturity_date: A `DateTensor` specifying the end of the accrual period
      for the forward rate. The shape of `end_date` must be broadcastable
      with the shape of `start_date`. The function expects either `end_date`
      or `end_time` to be specified.
    start_time: A real `Tensor` specifying the start of the accrual period
      for the forward rate. The function expects either `start_date` or
      `start_time` to be specified.
    maturity_time: A real `Tensor` specifying the end of the accrual period
      for the forward rate. The shape of `end_date` must be broadcastable
      with the shape of `start_date`. The function expects either `end_date`
      or `end_time` to be specified.
    day_count_fraction: An optional `Tensor` of real dtype specifying the
      time between `start_date` and `maturity_date` in years computed using
      the forward rate's day count basis. The shape of the input should be
      the same as that of `start_date` and `maturity_date`.
      Default value: `None`, in which case the daycount fraction is computed
        using `daycount_convention`.
  
  Returns:
    A real `Tensor` of same shape as the inputs containing the simply
    compounded forward rate.
docstr_tok: ["Returns","the","simply","accrued","forward","rate","between","[","start_dt",",","maturity_dt","]",".","Args",":","start_date",":","A","`","DateTensor","`","specifying","the","start","of","the","accrual","period","for","the","forward","rate",".","The","function","expects","either","`","start_date","`","or","`","start_time","`","to","be","specified",".","maturity_date",":","A","`","DateTensor","`","specifying","the","end","of","the","accrual","period","for","the","forward","rate",".","The","shape","of","`","end_date","`","must","be","broadcastable","with","the","shape","of","`","start_date","`",".","The","function","expects","either","`","end_date","`","or","`","end_time","`","to","be","specified",".","start_time",":","A","real","`","Tensor","`","specifying","the","start","of","the","accrual","period","for","the","forward","rate",".","The","function","expects","either","`","start_date","`","or","`","start_time","`","to","be","specified",".","maturity_time",":","A","real","`","Tensor","`","specifying","the","end","of","the","accrual","period","for","the","forward","rate",".","The","shape","of","`","end_date","`","must","be","broadcastable","with","the","shape","of","`","start_date","`",".","The","function","expects","either","`","end_date","`","or","`","end_time","`","to","be","specified",".","day_count_fraction",":","An","optional","`","Tensor","`","of","real","dtype","specifying","the","time","between","`","start_date","`","and","`","maturity_date","`","in","years","computed","using","the","forward","rate","'s","day","count","basis",".","The","shape","of","the","input","should","be","the","same","as","that","of","`","start_date","`","and","`","maturity_date","`",".","Default","value",":","`","None","`",",","in","which","case","the","daycount","fraction","is","computed","using","`","daycount_convention","`",".","Returns",":","A","real","`","Tensor","`","of","same","shape","as","the","inputs","containing","the","simply","compounded","forward","rate","."]
code: def forward_rate(
      self,
      start_date: Optional[types.DateTensor] = None,
      maturity_date: Optional[types.DateTensor] = None,
      start_time: Optional[types.FloatTensor] = None,
      maturity_time: Optional[types.FloatTensor] = None,
      day_count_fraction: Optional[tf.Tensor] = None,
  ):
      """Returns the simply accrued forward rate between [start_dt, maturity_dt].
  
      Args:
        start_date: A `DateTensor` specifying the start of the accrual period
          for the forward rate. The function expects either `start_date` or
          `start_time` to be specified.
        maturity_date: A `DateTensor` specifying the end of the accrual period
          for the forward rate. The shape of `end_date` must be broadcastable
          with the shape of `start_date`. The function expects either `end_date`
          or `end_time` to be specified.
        start_time: A real `Tensor` specifying the start of the accrual period
          for the forward rate. The function expects either `start_date` or
          `start_time` to be specified.
        maturity_time: A real `Tensor` specifying the end of the accrual period
          for the forward rate. The shape of `end_date` must be broadcastable
          with the shape of `start_date`. The function expects either `end_date`
          or `end_time` to be specified.
        day_count_fraction: An optional `Tensor` of real dtype specifying the
          time between `start_date` and `maturity_date` in years computed using
          the forward rate's day count basis. The shape of the input should be
          the same as that of `start_date` and `maturity_date`.
          Default value: `None`, in which case the daycount fraction is computed
            using `daycount_convention`.
  
      Returns:
        A real `Tensor` of same shape as the inputs containing the simply
        compounded forward rate.
      """
      if start_date is None and start_time is None:
          raise ValueError(
              "Either start_date or start_times " "must be supplied."
          )
      if maturity_date is None and maturity_time is None:
          raise ValueError(
              "Either maturity_date or maturity_time must be "
              "supplied."
          )
  
      if start_date is not None and maturity_date is not None:
          start_date = dateslib.convert_to_date_tensor(start_date)
          maturity_date = dateslib.convert_to_date_tensor(maturity_date)
          if day_count_fraction is None:
              day_count_fn = self._day_count_fn
              day_count_fraction = day_count_fn(
                  start_date=start_date,
                  end_date=maturity_date,
                  dtype=self._dtype,
              )
          else:
              day_count_fraction = tf.convert_to_tensor(
                  day_count_fraction,
                  self._dtype,
                  name="day_count_fraction",
              )
          start_time = self._get_time(start_date)
          maturity_time = self._get_time(maturity_date)
      else:
          start_time = tf.convert_to_tensor(
              start_time, dtype=self._dtype
          )
          maturity_time = tf.convert_to_tensor(
              maturity_time, dtype=self._dtype
          )
          day_count_fraction = maturity_time - start_time
  
      dfstart = self.discount_factor(interpolation_times=start_time)
      dfmaturity = self.discount_factor(
          interpolation_times=maturity_time
      )
      return tf.math.divide_no_nan(
          tf.math.divide_no_nan(dfstart, dfmaturity) - 1.0,
          day_count_fraction,
      )
  
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 10 for calling the RateCurve obj's underlying member method code with example usage: obj.forward_rate(start_date, maturity_date, start_time, maturity_time, day_count_fraction) and returns: tf