code: def ordinal_to_year_month_day(ordinals):
      """Calculates years, months and dates Tensor given ordinals Tensor.
  
      Args:
        ordinals: Tensor of int32 type. Each element is number of days since 1 Jan
         0001. 1 Jan 0001 has `ordinal = 1`.
  
      Returns:
        Tuple (years, months, days), each element is an int32 Tensor of the same
        shape as `ordinals`. `months` and `days` are one-based.
      """
      with tf.compat.v1.name_scope(None, "o2ymd", [ordinals]):
          ordinals = tf.convert_to_tensor(
              ordinals, dtype=tf.int32, name="ordinals"
          )
  
          # The algorithm is adapted from
          # http://howardhinnant.github.io/date_algorithms.html
  
          # Take the fictional date of 1 March 0000 as reference and consider 1 March
          # as start of the year. This simplifies computations.
          ordinals -= _ORDINAL_OF_1_3_0000
          era = ordinals // _DAYS_IN_ERA
          day_of_era = ordinals % _DAYS_IN_ERA
          year_of_era = (
              day_of_era
              - day_of_era // (_DAYS_IN_4_YEARS - 1)
              + day_of_era // _DAYS_IN_100_YEARS
              - day_of_era // (_DAYS_IN_ERA - 1)
          ) // _DAYS_IN_YEAR
          year = year_of_era + era * _YEARS_IN_ERA
          day_of_year = day_of_era - (
              _DAYS_IN_YEAR * year_of_era
              + year_of_era // 4
              - year_of_era // 100
          )
          months = _day_of_year_to_month(day_of_year)
          days = day_of_year - _days_in_year_before_month(months) + 1
  
          # Go back from 1 March to 1 January as start of year.
          months = months + tf.compat.v2.where(months < 10, 3, -9)
          year += tf.compat.v2.where(months <= 2, 1, 0)
          return year, months, days
  
file_path: tf-quant-finance/tf_quant_finance/datetime/date_utils.py
imports: import tensorflow.compat.v2
label_desc: Use image node_id 3 for calling a global function with example usage: ordinal_to_year_month_day(ordinals) and returns: year,  months,  days