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: Initialize optimizer variables.
  
  Nadam optimizer has 2 types of variables: momentums and velocities.
  
  Args:
      var_list: list of model variables to build Nadam variables on.
docstr_tok: ["Initialize","optimizer","variables",".","Nadam","optimizer","has","2","types","of","variables",":","momentums","and","velocities",".","Args",":","var_list",":","list","of","model","variables","to","build","Nadam","variables","on","."]
code: def build(self, var_list):
      """Initialize optimizer variables.
  
      Nadam optimizer has 2 types of variables: momentums and velocities.
  
      Args:
          var_list: list of model variables to build Nadam variables on.
      """
      if self.built:
          return
      if var_list:
          dtype = var_list[0].dtype
      else:
          dtype = backend.floatx()
      super().build(var_list)
      self._momentums = []
      self._velocities = []
      self._u_product = backend.Variable(1.0, dtype=dtype)
  
      for var in var_list:
          self._momentums.append(
              self.add_variable_from_reference(
                  reference_variable=var, name="momentum"
              )
          )
          self._velocities.append(
              self.add_variable_from_reference(
                  reference_variable=var, name="velocity"
              )
          )
  
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 2 for calling the Nadam obj's underlying member method code with example usage: obj.build(var_list) without return types