code: def from_year_month_day(year, month, day, validate=True):
      """Creates DateTensor from tensors of years, months and days.
  
      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.
        validate: Whether to validate the dates.
  
      Returns:
        DateTensor object.
  
      #### Example
  
      ```python
      year = tf.constant([2015, 2017], dtype=tf.int32)
      month = tf.constant([4, 12], dtype=tf.int32)
      day = tf.constant([15, 30], dtype=tf.int32)
      date_tensor = tff.datetime.dates_from_year_month_day(year, month, day)
      ```
      """
      year = tf.convert_to_tensor(year, tf.int32)
      month = tf.convert_to_tensor(month, tf.int32)
      day = tf.convert_to_tensor(day, tf.int32)
  
      control_deps = []
      if validate:
          control_deps.append(
              tf.debugging.assert_positive(
                  year, message="Year must be positive."
              )
          )
          control_deps.append(
              tf.debugging.assert_greater_equal(
                  month,
                  constants.Month.JANUARY.value,
                  message=f"Month must be >= {constants.Month.JANUARY.value}",
              )
          )
          control_deps.append(
              tf.debugging.assert_less_equal(
                  month,
                  constants.Month.DECEMBER.value,
                  message="Month must be <= {constants.Month.JANUARY.value}",
              )
          )
          control_deps.append(
              tf.debugging.assert_positive(
                  day, message="Day must be positive."
              )
          )
          is_leap = date_utils.is_leap_year(year)
          days_in_months = tf.constant(
              _DAYS_IN_MONTHS_COMBINED, tf.int32
          )
          max_days = tf.gather(
              days_in_months,
              month + 12 * tf.dtypes.cast(is_leap, np.int32),
          )
          control_deps.append(
              tf.debugging.assert_less_equal(
                  day, max_days, message="Invalid day-month pairing."
              )
          )
          with tf.compat.v1.control_dependencies(control_deps):
              # Ensure years, months, days themselves are under control_deps.
              year = tf.identity(year)
              month = tf.identity(month)
              day = tf.identity(day)
  
      with tf.compat.v1.control_dependencies(control_deps):
          ordinal = date_utils.year_month_day_to_ordinal(
              year, month, day
          )
          return DateTensor(ordinal, year, month, day)
  
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 6 for calling a global function with example usage: from_year_month_day(year, month, day, validate) and returns: DateTensor