class_docstr: Represents a tensor of dates.
class_docstr_tok: ["Represents","a","tensor","of","dates","."]
docstr: Adds a tensor of periods.
  
  When adding months or years, the resulting day of the month is decreased
  to the largest valid value if necessary. E.g. 31.03.2020 + 1 month =
  30.04.2020, 29.02.2020 + 1 year = 28.02.2021.
  
  Args:
    period_tensor: A `PeriodTensor` object broadcastable to the shape of
    "self".
  
  Returns:
    The new instance of DateTensor.
  
  #### Example
  ```python
  dates = tff.datetime.dates_from_tuples([(2020, 2, 25), (2020, 3, 31)])
  new_dates = dates + tff.datetime.month()
  # DateTensor([(2020, 3, 25), (2020, 4, 30)])
  
  new_dates = dates + tff.datetime.month([1, 2])
  # DateTensor([(2020, 3, 25), (2020, 5, 31)])
  ```
code: def __add__(self, period_tensor):
      """Adds a tensor of periods.
  
      When adding months or years, the resulting day of the month is decreased
      to the largest valid value if necessary. E.g. 31.03.2020 + 1 month =
      30.04.2020, 29.02.2020 + 1 year = 28.02.2021.
  
      Args:
        period_tensor: A `PeriodTensor` object broadcastable to the shape of
        "self".
  
      Returns:
        The new instance of DateTensor.
  
      #### Example
      ```python
      dates = tff.datetime.dates_from_tuples([(2020, 2, 25), (2020, 3, 31)])
      new_dates = dates + tff.datetime.month()
      # DateTensor([(2020, 3, 25), (2020, 4, 30)])
  
      new_dates = dates + tff.datetime.month([1, 2])
      # DateTensor([(2020, 3, 25), (2020, 5, 31)])
      ```
      """
      period_type = period_tensor.period_type()
  
      if period_type == constants.PeriodType.DAY:
          ordinals = self._ordinals + period_tensor.quantity()
          return from_ordinals(ordinals)
  
      if period_type == constants.PeriodType.WEEK:
          return self + periods.PeriodTensor(
              period_tensor.quantity() * 7, constants.PeriodType.DAY
          )
  
      def adjust_day(year, month, day):
          return tf.math.minimum(day, _num_days_in_month(month, year))
  
      if period_type == constants.PeriodType.MONTH:
          m = self._months - 1 + period_tensor.quantity()
          y = self._years + m // 12
          m = m % 12 + 1
          d = adjust_day(y, m, self._days)
          return from_year_month_day(y, m, d, validate=False)
  
      if period_type == constants.PeriodType.YEAR:
          y = self._years + period_tensor.quantity()
          # Use tf.shape to handle the case of dynamically shaped `y`
          m = tf.broadcast_to(self._months, tf.shape(y))
          d = adjust_day(y, m, self._days)
          return from_year_month_day(y, m, d, validate=False)
  
      raise ValueError(
          "Unrecognized period type: {}".format(period_type)
      )
  
imports: import collections.abc
  import datetime
  import numpy
  import tensorflow.compat.v2
  from tf_quant_finance.datetime import constants
  from tf_quant_finance.datetime import date_utils
  from tf_quant_finance.datetime import periods
  from tf_quant_finance.datetime import tensor_wrapper
label_desc: Use image node_id 15 for calling the DateTensor obj's underlying member method code with example usage: obj.__add__(period_tensor) and returns: from_ordinals, unknown, tf, from_year_month_day, from_year_month_day