Skip to main content

Module optim

Module optim 

Source
Expand description

Optimizers with the computations of Optax’s: gradient transformations that are chained, applied to the gradient, and whose result is added to the parameters.

The transformations are generic over the backend, so a training step runs natively or is traced (and compiled with XLA, inside jit). They follow the operations of Optax 0.2, so that with the same inputs they compute the same values.

Structs§

AdamState
The state of ScaleByAdam (optax.ScaleByAdamState).
Chain
Two transformations applied one after the other (optax.chain).
ClipByGlobalNorm
Scales the updates so that their global norm is at most max_norm (optax.clip_by_global_norm).
LinearSchedule
init decreasing (or increasing) linearly to end over transition_steps updates, then constant (optax.linear_schedule).
Scale
Multiplies the updates by a constant (optax.scale).
ScaleByAdam
Adam’s rescaling of the updates (optax.scale_by_adam).
ScaleBySchedule
Multiplies the updates by minus the learning rate of the schedule (optax.scale_by_learning_rate with a schedule).

Traits§

GradientTransformation
A transformation of updates (optax.GradientTransformation), applied to the leaves of the parameters, all of type T.
Schedule
A learning rate that depends on the number of updates so far (optax.Schedule).

Functions§

adam
Adam with a constant learning rate (optax.adam); set the other hyperparameters on the result’s first part.
adam_with_schedule
Adam with a learning rate schedule (optax.adam with a schedule).
apply_updates
params + updates for each leaf (optax.apply_updates).
chain
Applies a, then c (optax.chain(a, c)).
clip_by_global_norm
See ClipByGlobalNorm.
global_norm
The L2 norm of all the leaves together (optax.tree.norm).
linear_schedule
See LinearSchedule.
sgd
Stochastic gradient descent with a constant learning rate (optax.sgd without momentum).