code: def year_month_day_to_ordinal(year, month, day):
      """Calculates ordinals Tensor given years, months and dates.
  
      Args:
        year: Tensor of int32 type. Elements should be positive.
        month: Tensor of int32 type of same shape as `year`. Elements should be in
          range `[1, 12]`.
        day: Tensor of int32 type of same shape as `year`. Elements should be in
          range `[1, 31]` and represent valid dates together with corresponding
          elements of `month` and `year` Tensors.
  
      Returns:
        Tensor of int32 type. Each element is number of days since 1 Jan 0001. 1 Jan
        0001 has `ordinal = 1`.
      """
      with tf.compat.v1.name_scope(None, "ymd2o", [year, month, day]):
          year = tf.convert_to_tensor(year, tf.int32, name="year")
          month = tf.convert_to_tensor(month, tf.int32, name="month")
          day = tf.convert_to_tensor(day, tf.int32, name="day")
  
          # 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.
          year -= tf.compat.v2.where(month <= 2, 1, 0)
          month += tf.compat.v2.where(month > 2, -3, 9)
  
          era = year // _YEARS_IN_ERA
          year_of_era = year % _YEARS_IN_ERA
          day_of_year = _days_in_year_before_month(month) + day - 1
          day_of_era = (
              year_of_era * _DAYS_IN_YEAR
              + year_of_era // 4
              - year_of_era // 100
              + day_of_year
          )
          return era * _DAYS_IN_ERA + day_of_era + _ORDINAL_OF_1_3_0000
  
file_path: tf-quant-finance/tf_quant_finance/datetime/date_utils.py
imports: import tensorflow.compat.v2
label_desc: Use image node_id 4 for calling a global function with example usage: year_month_day_to_ordinal(year, month, day) and returns: unknown