We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
easy
primitives
Constant Schedule
Why this matters
optax.constant_schedule(value) returns a callable that ignores the step
and always returns value. It is the simplest possible schedule: useful as
a baseline, as the “hold” phase inside a more complex chain, or when you
want the familiar Optax schedule API without any decay at all.
The schedule API
Every Optax schedule is a callable schedule(step) -> lr. For a constant
schedule this is trivially:
schedule = optax.constant_schedule(lr_value)
lr = schedule(step) # always lr_value, regardless of step
Common usage pattern:
schedule = optax.constant_schedule(lr_value)
optimizer = optax.adam(learning_rate=schedule)
Common pitfalls
- A schedule is a callable — it must be called with the step to get the LR; it is not a number.
-
Combining schedules with
optax.join_schedulesoroptax.chainrequires callables, not raw floats.
Inputs
-
step: scalar (cast to int before calling the schedule). -
lr_value: scalar learning rate to return at every step.
Output
Scalar — the constant LR (always lr_value).
Hints
optax
schedule
constant
Sign in to attempt this problem and view the solution.