google / google/jax-datetime

How to compute a jax-compatible time of year?

Open
#14 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14
Forks
3
PR merge metrics
No merged PRs in 30d

Description

I need to compute the time of year using jax_datetime as a float in the interval [0, 1), which is computed as follows:

1. `total_days_of_year(dt: jax_datetime.Datetime) -> jax.typing.ArrayLike`: Returns the total days of the year specified by `dt`.
2. `day_of_year(dt: jax_datetime.Datetime) -> jax.typing.ArrayLike`: Returns the day of the year specified by `dt`.
3. The desired `normalized_day_of_year(dt: jax_datetime.Datetime) = day_of_year(dt) / total_days_of_year(dt)`.

I need this resulting float to be jax-compatible. How can I achieve this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.