Adam

class dragon.vm.tensorflow.keras.optimizers.Adam(
  learning_rate=0.001,
  beta_1=0.9,
  beta_2=0.999,
  epsilon=1e-07,
  name=None,
  **kwargs
)[source]

The optimizer to apply Adam algorithm. [Kingma & Ba, 2014].

The Adam update is defined as:

\[\text{Adam}(g) = -\frac{\text{lr} * m_{t}}{\sqrt{v_{t}} + \epsilon} \\ \quad \\ \text{where}\quad \begin{cases} m_{t} = \beta_{1} * m_{t-1} + (1 - \beta_{1}) * g \\ v_{t} = \beta_{2} * v_{t-1} + (1 - \beta_{2}) * g^{2} \end{cases} \]

__init__

Adam.__init__(
  learning_rate=0.001,
  beta_1=0.9,
  beta_2=0.999,
  epsilon=1e-07,
  name=None,
  **kwargs
)[source]

Create an Adam optimizer.

Parameters:
  • learning_rate (float, optional, default=0.001) – The initial value for \(\text{lr}\).
  • beta_1 (float, optional, default=0.9) – The initial value for \(\beta_{1}\).
  • beta_2 (float, optional, default=0.999) – The initial value for \(\beta_{2}\).
  • epsilon (float, optional, default=1e-7) – The initial value for \(\epsilon\).
  • name (str, optional) – The optional optimizer name.

Properties

iterations

Optimizer.iterations

Return the number of steps has run.

Returns:
int – The iterations.

Methods

apply_gradients

Optimizer.apply_gradients(grads_and_vars)[source]

Apply the gradients to update variables.

Parameters:
  • grads_and_vars (Sequence[Sequence[dragon.Tensor]]) – The gradients and variables.
Returns:

dragon.vm.tensorflow.keras.optimizers.Optimizer – The self to generate the update operations.