code: def from_tensor(tensor, validate=True):
      """Creates DateTensor from a single tensor containing years, months and days.
  
      This function is complementary to DateTensor.to_tensor: given an int32 Tensor
      of shape (..., 3), creates a DateTensor. The three elements of the last
      dimension are years, months and days, in this order.
  
      Args:
        tensor: Tensor of type int32 and shape (..., 3).
        validate: Whether to validate the dates.
  
      Returns:
        DateTensor object.
  
      #### Example
  
      ```python
      tensor = tf.constant([[2015, 4, 15], [2017, 12, 30]], dtype=tf.int32)
      date_tensor = tff.datetime.dates_from_tensor(tensor)
      ```
      """
      tensor = tf.convert_to_tensor(tensor, dtype=tf.int32)
      return from_year_month_day(
          year=tensor[..., 0],
          month=tensor[..., 1],
          day=tensor[..., 2],
          validate=validate,
      )
  
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 a global function with example usage: from_tensor(tensor, validate) and returns: from_year_month_day