# tf.keras.optimizers.Nadam

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v2.7.0/keras/optimizer_v2/nadam.py#L24-L213) |

Optimizer that implements the NAdam algorithm.

Inherits From: [`Optimizer`](https://www.tensorflow.org/versions/r2.7/api_docs/python/tf/keras/optimizers/Optimizer)

#### View aliases


**Main aliases**

[`tf.optimizers.Nadam`](https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/experimental/Nadam)
**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.keras.optimizers.Nadam`](https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/legacy/Nadam)

<br />

    tf.keras.optimizers.Nadam(
        learning_rate=0.001,
        beta_1=0.9,
        beta_2=0.999,
        epsilon=1e-07,
        name='Nadam',
        **kwargs
    )

Much like Adam is essentially RMSprop with momentum, Nadam is Adam with
Nesterov momentum.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `learning_rate` | A Tensor or a floating point value. The learning rate. |
| `beta_1` | A float value or a constant float tensor. The exponential decay rate for the 1st moment estimates. |
| `beta_2` | A float value or a constant float tensor. The exponential decay rate for the exponentially weighted infinity norm. |
| `epsilon` | A small constant for numerical stability. |
| `name` | Optional name for the operations created when applying gradients. Defaults to `"Nadam"`. |
| `**kwargs` | Keyword arguments. Allowed to be one of `"clipnorm"` or `"clipvalue"`. `"clipnorm"` (float) clips gradients by norm; `"clipvalue"` (float) clips gradients by value. |

<br />

<br />

<br />

<br />

| ## Usage Example ||
|---|---|
| <br /> >>> opt = tf.keras.optimizers.Nadam(learning_rate=0.2) >>> var1 = tf.Variable(10.0) >>> loss = lambda: (var1 ** 2) / 2.0 >>> step_count = opt.minimize(loss, [var1]).numpy() >>> "{:.1f}".format(var1.numpy()) 9.8 <br /> ||

<br />

<br />

<br />

| ## Reference ||
|---|---|
| <br /> - [Dozat, 2015](http://cs229.stanford.edu/proj2015/054_report.pdf). ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | in case of any invalid argument. |

<br />