SGD

class dragon.optimizers.SGD(
  lr=0.01,
  momentum=0.9,
  **kwargs
)[source]

The optimizer to apply MomentumSGD algorithm. [Polyak, 1964].

The MomentumSGD update is defined as:

\[\text{MomentumSGD}(g) = -(\text{momentum} * m_{t-1} + \text{lr} * g) \]

__init__

SGD.__init__(
  lr=0.01,
  momentum=0.9,
  **kwargs
)[source]

Create a SGD updater.

Parameters:
  • lr (float, optional, default=0.01) – The initial value to \(\text{lr}\).
  • momentum (float, optional, default=0.9) – The initial value to \(\text{momentum}\).

Methods

apply_gradients

Optimizer.apply_gradients(grads_and_vars)[source]

Apply the gradients on variables.

Parameters:
  • grads_and_vars (Sequence[Sequence[dragon.Tensor]]) – The sequence of update pair.