class_docstr: Represents a batch of cashflows indexed to a floating rate.
class_docstr_tok: ["Represents","a","batch","of","cashflows","indexed","to","a","floating","rate","."]
docstr: Returns forward rates for the floating leg.
  
  Args:
    market: An instance of `ProcessedMarketData`.
    past_fixing: An optional `Tensor` of shape compatible with
      `batch_shape + [1]`. Represents the fixings for the cashflows as
      observed at `market.date`.
    name: Python str. The name to give to the ops created by this function.
      Default value: `None` which maps to 'forward_rates'.
  
  Returns:
    A tuple of two `Tensor`s of shape `batch_shape + [num_cashflows]`
    containing the dates and the corresponding forward rates for each stream
    based on the input market data.
code: def forward_rates(
      self,
      market: pmd.ProcessedMarketData,
      past_fixing: Optional[types.FloatTensor] = None,
      name: Optional[str] = None,
  ) -> Tuple[types.DateTensor, types.FloatTensor]:
      """Returns forward rates for the floating leg.
  
      Args:
        market: An instance of `ProcessedMarketData`.
        past_fixing: An optional `Tensor` of shape compatible with
          `batch_shape + [1]`. Represents the fixings for the cashflows as
          observed at `market.date`.
        name: Python str. The name to give to the ops created by this function.
          Default value: `None` which maps to 'forward_rates'.
  
      Returns:
        A tuple of two `Tensor`s of shape `batch_shape + [num_cashflows]`
        containing the dates and the corresponding forward rates for each stream
        based on the input market data.
      """
      name = name or (self._name + "_forward_rates")
      with tf.name_scope(name):
          reference_curve = get_discount_curve(
              self._reference_curve_type, market, self._reference_mask
          )
          valuation_date = dateslib.convert_to_date_tensor(market.date)
  
          # Previous fixing date
          coupon_start_date_ord = self._coupon_start_dates.ordinal()
          coupon_end_date_ord = self._coupon_end_dates.ordinal()
          valuation_date_ord = valuation_date.ordinal()
          batch_shape = tf.shape(coupon_start_date_ord)[:-1]
          # Broadcast valuation date batch shape for tf.searchsorted
          valuation_date_ord += tf.expand_dims(
              tf.zeros(batch_shape, dtype=tf.int32), axis=-1
          )
          ind = tf.maximum(
              tf.searchsorted(coupon_start_date_ord, valuation_date_ord)
              - 1,
              0,
          )
          # Fixings are assumed to be the same as coupon start dates
          # TODO(b/177047910): add fixing settlement dates.
          # Shape `batch_shape + [1]`
          fixing_dates_ord = tf.gather(
              coupon_start_date_ord,
              ind,
              batch_dims=len(coupon_start_date_ord.shape) - 1,
          )
          fixing_end_dates_ord = tf.gather(
              coupon_end_date_ord,
              ind,
              batch_dims=len(coupon_start_date_ord.shape) - 1,
          )
          fixing_dates = dateslib.dates_from_ordinals(fixing_dates_ord)
          fixing_end_dates = dateslib.dates_from_ordinals(
              fixing_end_dates_ord
          )
          # Get fixings. Shape batch_shape + [1]
          if past_fixing is None:
              past_fixing = _get_fixings(
                  fixing_dates,
                  fixing_end_dates,
                  self._reference_curve_type,
                  self._reference_mask,
                  market,
              )
          else:
              past_fixing = tf.convert_to_tensor(
                  past_fixing, dtype=self._dtype, name="past_fixing"
              )
          forward_rates = reference_curve.forward_rate(
              self._accrual_start_date,
              self._accrual_end_date,
              day_count_fraction=self._daycount_fractions,
          )
          # Shape batch_shape + [num_cashflows]
          forward_rates = tf.where(
              self._daycount_fractions > 0.0,
              forward_rates,
              tf.zeros_like(forward_rates),
          )
          # If coupon end date is before the valuation date, the payment is in the
          # past. If valuation date is between coupon start date and coupon end
          # date, then the rate has been fixed but not paid. Otherwise the rate is
          # not fixed and should be read from the curve.
          # Shape batch_shape + [num_cashflows]
          forward_rates = tf.where(
              self._coupon_end_dates < valuation_date,
              tf.constant(0, dtype=self._dtype),
              tf.where(
                  self._coupon_start_dates >= valuation_date,
                  forward_rates,
                  past_fixing,
              ),
          )
          return self._coupon_end_dates, forward_rates
  
imports: from typing import Optional, Tuple, Callable, Any, List, Union
  import numpy
  import tensorflow.compat.v2
  from tf_quant_finance import datetime
  from tf_quant_finance.experimental.pricing_platform.framework.core import curve_types
  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 rate_curve
  from tf_quant_finance.experimental.pricing_platform.framework.market_data import utils
  from tf_quant_finance.experimental.pricing_platform.framework.rate_instruments import coupon_specs
  from tf_quant_finance.experimental.pricing_platform.instrument_protos import period_pb2
  from tf_quant_finance.math import pad
label_desc: Use image node_id 11 for calling the FloatingCashflowStream obj's underlying member method code with example usage: obj.forward_rates(market, past_fixing, name) and returns: self,  forward_rates