<!--
This file is generated by a tool. Do not edit directly.
For open-source contributions the docs will be updated automatically.
-->

*Last updated: 2023-03-16.*

<div itemscope itemtype="http://developers.google.com/ReferenceObject">
<meta itemprop="name" content="tf_quant_finance.datetime.dates_from_tensor" />
<meta itemprop="path" content="Stable" />
</div>

# tf_quant_finance.datetime.dates_from_tensor

<!-- Insert buttons and diff -->

<table class="tfo-notebook-buttons tfo-api" align="left">
</table>

<a target="_blank" href="https://github.com/paolodelia99/tf-quant-finance/blob/main/tf_quant_finance/datetime/date_tensor.py">View source</a>



Creates DateTensor from a single tensor containing years, months and days.

```python
tf_quant_finance.datetime.dates_from_tensor(
    tensor, validate=True
)
```



<!-- Placeholder for "Used in" -->

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:


* <b>`tensor`</b>: Tensor of type int32 and shape (..., 3).
* <b>`validate`</b>: 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)
```