class_docstr: Represents a tensor of dates.
class_docstr_tok: ["Represents","a","tensor","of","dates","."]
docstr: Calculates the number of days since the beginning of the year.
  
  Returns:
    Tensor of int32 type with elements in range [1, 366]. January 1st yields
    "1".
  
  #### Example
  
  ```python
  dt = tff.datetime.dates_from_tuples([(2019, 1, 25), (2020, 3, 2)])
  dt.day_of_year()  # [25, 62]
  ```
code: def day_of_year(self):
      """Calculates the number of days since the beginning of the year.
  
      Returns:
        Tensor of int32 type with elements in range [1, 366]. January 1st yields
        "1".
  
      #### Example
  
      ```python
      dt = tff.datetime.dates_from_tuples([(2019, 1, 25), (2020, 3, 2)])
      dt.day_of_year()  # [25, 62]
      ```
      """
      if self._day_of_year is None:
          cumul_days_in_month_nonleap = tf.math.cumsum(
              _DAYS_IN_MONTHS_NON_LEAP, exclusive=True
          )
          cumul_days_in_month_leap = tf.math.cumsum(
              _DAYS_IN_MONTHS_LEAP, exclusive=True
          )
          days_before_month_non_leap = tf.gather(
              cumul_days_in_month_nonleap, self.month() - 1
          )
          days_before_month_leap = tf.gather(
              cumul_days_in_month_leap, self.month() - 1
          )
          days_before_month = tf.where(
              date_utils.is_leap_year(self.year()),
              days_before_month_leap,
              days_before_month_non_leap,
          )
          self._day_of_year = days_before_month + self.day()
      return self._day_of_year
  
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 8 for calling the DateTensor obj's underlying member method code with example usage: obj.day_of_year() and returns: self