Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving docstrings for schedules. #692

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions optax/schedules/_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def polynomial_schedule(
init_value: initial value for the scalar to be annealed.
end_value: end value of the scalar to be annealed.
power: the power of the polynomial used to transition from init to end.
transition_steps: number of steps over which annealing takes place,
the scalar starts changing at `transition_begin` steps and completes
transition_steps: number of steps over which annealing takes place.
The scalar starts changing at `transition_begin` steps and completes
the transition by `transition_begin + transition_steps` steps.
If `transition_steps <= 0`, then the entire annealing process is disabled
and the value is held fixed at `init_value`.
Expand All @@ -76,7 +76,7 @@ def polynomial_schedule(

if transition_begin < 0:
logging.info(
'An exponential schedule was set with a negative `transition_begin` '
'A polynomial schedule was set with a negative `transition_begin` '
'value; this will result in `transition_begin` falling back to `0`.')
transition_begin = 0

Expand Down Expand Up @@ -142,10 +142,12 @@ def exponential_decay(
"""Constructs a schedule with either continuous or discrete exponential decay.

This function applies an exponential decay function to a provided initial
value. The function returns the decayed value as follows:
value. When `count >= transition_begin` the function returns the decayed value
as follows:

```
decayed_value = init_value * decay_rate ^ (count / transition_steps)
decayed_value = init_value * decay_rate ^ ((count - transition_begin)
/ transition_steps)
```

If the argument `staircase` is `True`, then `count / transition_steps` is
Expand Down
Loading