tf_quant_finance.datetime.dates_from_year_month_day

Last updated: 2023-03-16.

tf_quant_finance.datetime.dates_from_year_month_day#

View source

Creates DateTensor from tensors of years, months and days.

tf_quant_finance.datetime.dates_from_year_month_day(
    year, month, day, validate=True
)

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#

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)