# mx.symbol.adam_update¶

## Description¶

Adam update consists of the following steps, where g represents gradient and m, v are 1st and 2nd order moment estimates (mean and variance).

$\begin{split} g_t = \nabla J(W_{t-1})\\ m_t = \beta_1 m_{t-1} + (1 - \beta_1) g_t\\ v_t = \beta_2 v_{t-1} + (1 - \beta_2) g_t^2\\ W_t = W_{t-1} - \alpha \frac{ m_t }{ \sqrt{ v_t } + \epsilon }\end{split}$

m = beta1*m + (1-beta1)*grad
w += - learning_rate * m / (sqrt(v) + epsilon)

However, if grad's storage type is row_sparse, lazy_update is True and the storage
type of weight is the same as those of m and v,


only the row slices whose indices appear in grad.indices are updated (for w, m and v):

for row in grad.indices:
w[row] += - learning_rate * m[row] / (sqrt(v[row]) + epsilon)


## Usage¶

mx.symbol.adam_update(...)


## Arguments¶

Argument

Description

weight

NDArray-or-Symbol.

Weight

grad

NDArray-or-Symbol.

mean

NDArray-or-Symbol.

Moving mean

var

NDArray-or-Symbol.

Moving variance

lr

float, required.

Learning rate

beta1

float, optional, default=0.9.

The decay rate for the 1st moment estimates.

beta2

float, optional, default=0.999.

The decay rate for the 2nd moment estimates.

epsilon

float, optional, default=1e-08.

A small constant for numerical stability.

wd

float, optional, default=0.

Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.

rescale.grad

float, optional, default=1.

clip.gradient

float, optional, default=-1.

lazy.update

boolean, optional, default=1.

If true, lazy updates are applied if gradient’s stype is row_sparse and all of w, m and v have the same stype

name

string, optional.

Name of the resulting symbol.

## Value¶

out The result mx.symbol