class_docstr: Optimizer that implements the Nadam algorithm.
  
  Much like Adam is essentially RMSprop with momentum, Nadam is Adam with
  Nesterov momentum.
  
  Args:
      learning_rate: A float, a
          `keras.optimizers.schedules.LearningRateSchedule` instance, or
          a callable that takes no arguments and returns the actual value to
          use. The learning rate. Defaults to `0.001`.
      beta_1: A float value or a constant float tensor, or a callable
          that takes no arguments and returns the actual value to use. The
          exponential decay rate for the 1st moment estimates.
          Defaults to `0.9`.
      beta_2: A float value or a constant float tensor, or a callable
          that takes no arguments and returns the actual value to use. The
          exponential decay rate for the 2nd moment estimates. Defaults to
          `0.999`.
      epsilon: A small constant for numerical stability. This epsilon is
          "epsilon hat" in the Kingma and Ba paper (in the formula just before
          Section 2.1), not the epsilon in Algorithm 1 of the paper.
          Defaults to `1e-7`.
      {{base_optimizer_keyword_args}}
  
  Reference:
  
  - [Dozat, 2015](http://cs229.stanford.edu/proj2015/054_report.pdf).
docstr: Update step given gradient and the associated model variable.
docstr_tok: ["Update","step","given","gradient","and","the","associated","model","variable","."]
code: def update_step(self, gradient, variable, learning_rate):
      """Update step given gradient and the associated model variable."""
      var_dtype = variable.dtype
      lr = ops.cast(learning_rate, var_dtype)
      gradient = ops.cast(gradient, var_dtype)
  
      local_step = ops.cast(self.iterations + 1, var_dtype)
      next_step = ops.cast(self.iterations + 2, var_dtype)
      decay = ops.cast(0.96, var_dtype)
      beta_1 = ops.cast(self.beta_1, var_dtype)
      beta_2 = ops.cast(self.beta_2, var_dtype)
      u_t = beta_1 * (1.0 - 0.5 * (ops.power(decay, local_step)))
      u_t_1 = beta_1 * (1.0 - 0.5 * (ops.power(decay, next_step)))
      u_product_t = ops.cast(self._u_product, var_dtype)
  
      u_product_t_1 = u_product_t * u_t_1
      beta_2_power = ops.power(beta_2, local_step)
  
      m = self._momentums[self._get_variable_index(variable)]
      v = self._velocities[self._get_variable_index(variable)]
  
      self.assign_add(
          m, ops.multiply(ops.subtract(gradient, m), (1 - beta_1))
      )
      self.assign_add(
          v,
          ops.multiply(
              ops.subtract(ops.square(gradient), v), (1 - beta_2)
          ),
      )
      m_hat = ops.add(
          ops.divide(ops.multiply(u_t_1, m), 1 - u_product_t_1),
          ops.divide(ops.multiply(1 - u_t, gradient), 1 - u_product_t),
      )
      v_hat = ops.divide(v, (1 - beta_2_power))
  
      self.assign_sub(
          variable,
          ops.divide(
              ops.multiply(m_hat, lr),
              ops.add(ops.sqrt(v_hat), self.epsilon),
          ),
      )
  
file_path: keras/keras/optimizers/nadam.py
imports: from keras import backend
  from keras import ops
  from keras.api_export import keras_export
  from keras.optimizers import optimizer
label_desc: Use image node_id 4 for calling the Nadam obj's underlying member method code with example usage: obj.update_step(gradient, variable, learning_rate) without return types