|View source on GitHub|
Represents an optimizer for use in TensorFlow Federated.
Its pair of
next methods define the optimization
next corresponding to a step of the optimizer.
This class captures iterative optimization algorithms where the same operation
is applied in every optimization step. The
next method should be a
computation that can be implemented as a
tf.function. Each method will
generally only be traced once to create the corresponding TensorFlow graph
functions. Thus, the methods should not create or use
Instead, any dependency between steps of the algorithm should be included
as tensors in a state. For instance, a momentum term for momentum SGD is
created in the
initialize method as all-zeros tensor, which is then both
an input and an output of the
initialize( specs )
Returns the initial state of the optimizer.
A (possibly nested) structure of
|Initial state of the optimizer. A (possibly nested) structure of tensors.|
next( state, weights, gradients )
Takes a step of the optimizer.
State of the optimizer. A structure of tensors matching the
structure returned by
The weights to be updated by the optimizer. A collection of
tensors matching the structure of
The gradients to use for the update by the optimizer. A
collection of tensors matching the structure of
A (state, weights) tuple representing the updated