class_docstr: Base class for Fixed or Floating cashflow streams.
class_docstr_tok: ["Base","class","for","Fixed","or","Floating","cashflow","streams","."]
docstr: Method to generate coupon dates.
  
  Args:
    cpn_frequency: A `PeriodTensor` specifying the frequency of coupon
      payments.
    roll_convention: Scalar of type `BusinessDayConvention` specifying how
      dates are rolled if they fall on holidays.
  
  Returns:
    A tuple containing the generated date schedule and a boolean `Tensor`
    of the same shape as the schedule specifying whether the coupons are
    regular coupons.
docstr_tok: ["Method","to","generate","coupon","dates",".","Args",":","cpn_frequency",":","A","`","PeriodTensor","`","specifying","the","frequency","of","coupon","payments",".","roll_convention",":","Scalar","of","type","`","BusinessDayConvention","`","specifying","how","dates","are","rolled","if","they","fall","on","holidays",".","Returns",":","A","tuple","containing","the","generated","date","schedule","and","a","boolean","`","Tensor","`","of","the","same","shape","as","the","schedule","specifying","whether","the","coupons","are","regular","coupons","."]
code: def _generate_schedule(self, cpn_frequency, roll_convention):
      """Method to generate coupon dates.
  
      Args:
        cpn_frequency: A `PeriodTensor` specifying the frequency of coupon
          payments.
        roll_convention: Scalar of type `BusinessDayConvention` specifying how
          dates are rolled if they fall on holidays.
  
      Returns:
        A tuple containing the generated date schedule and a boolean `Tensor`
        of the same shape as the schedule specifying whether the coupons are
        regular coupons.
      """
      if (self._first_coupon_date is None) and (
          self._penultimate_coupon_date is None
      ):
          cpn_dates = dates.PeriodicSchedule(
              start_date=self._start_date,
              end_date=self._end_date,
              tenor=cpn_frequency,
              roll_convention=roll_convention,
          ).dates()
          is_regular_cpn = tf.constant(
              True, dtype=bool, shape=cpn_dates[:, :-1].shape
          )
      elif self._first_coupon_date is not None:
          cpn_dates = dates.PeriodicSchedule(
              start_date=self._first_coupon_date,
              end_date=self._end_date,
              tenor=cpn_frequency,
              roll_convention=roll_convention,
          ).dates()
          cpn_dates = dates.DateTensor.concat(
              [self._start_date.expand_dims(-1), cpn_dates], axis=1
          )
  
          is_irregular_cpn = tf.constant(
              False, dtype=bool, shape=self._start_date.shape
          )
          is_regular_cpn = tf.concat(
              [
                  tf.expand_dims(is_irregular_cpn, axis=-1),
                  tf.constant(
                      True, dtype=bool, shape=cpn_dates[:, :-2].shape
                  ),
              ],
              axis=1,
          )
      else:
          cpn_dates = dates.PeriodicSchedule(
              start_date=self._start_date,
              end_date=self._penultimate_coupon_date,
              backward=True,
              tenor=cpn_frequency,
              roll_convention=roll_convention,
          ).dates()
          cpn_dates = dates.DateTensor.concat(
              [cpn_dates, self._end_date.expand_dims(-1)], axis=1
          )
  
          is_irregular_cpn = tf.constant(
              False, dtype=bool, shape=self._end_date.shape
          )
          is_regular_cpn = tf.concat(
              [
                  tf.constant(
                      True, dtype=bool, shape=cpn_dates[:, :-2].shape
                  ),
                  tf.expand_dims(is_irregular_cpn, axis=-1),
              ],
              axis=1,
          )
  
      return cpn_dates, is_regular_cpn
  
imports: import tensorflow.compat.v2
  from tf_quant_finance import datetime
  from tf_quant_finance.experimental.instruments import rates_common
label_desc: Use image node_id 1 for calling the CashflowStream obj's underlying member method code with example usage: obj._generate_schedule(cpn_frequency, roll_convention) and returns: cpn_dates,  is_regular_cpn