(learning_rate)
return optimizer
Configures the optimizer used for training.

  Args:
    learning_rate: A scalar or `Tensor` learning rate.

  Returns:
    An instance of an optimizer.

  Raises:
    ValueError: if FLAGS.optimizer is not recognized.
Configures the optimizer used for training.
Configures the optimizer used for training .
def _configure_optimizer(learning_rate):
  """Configures the optimizer used for training.

  Args:
    learning_rate: A scalar or `Tensor` learning rate.

  Returns:
    An instance of an optimizer.

  Raises:
    ValueError: if FLAGS.optimizer is not recognized.
  """
  if FLAGS.optimizer == 'adadelta':
    optimizer = tf.train.AdadeltaOptimizer(
        learning_rate,
        rho=FLAGS.adadelta_rho,
        epsilon=FLAGS.opt_epsilon)
  elif FLAGS.optimizer == 'adagrad':
    optimizer = tf.train.AdagradOptimizer(
        learning_rate,
        initial_accumulator_value=FLAGS.adagrad_initial_accumulator_value)
  elif FLAGS.optimizer == 'adam':
    optimizer = tf.train.AdamOptimizer(
        learning_rate,
        beta1=FLAGS.adam_beta1,
        beta2=FLAGS.adam_beta2,
        epsilon=FLAGS.opt_epsilon)
  elif FLAGS.optimizer == 'ftrl':
    optimizer = tf.train.FtrlOptimizer(
        learning_rate,
        learning_rate_power=FLAGS.ftrl_learning_rate_power,
        initial_accumulator_value=FLAGS.ftrl_initial_accumulator_value,
        l1_regularization_strength=FLAGS.ftrl_l1,
        l2_regularization_strength=FLAGS.ftrl_l2)
  elif FLAGS.optimizer == 'momentum':
    optimizer = tf.train.MomentumOptimizer(
        learning_rate,
        momentum=FLAGS.momentum,
        name='Momentum')
  elif FLAGS.optimizer == 'rmsprop':
    optimizer = tf.train.RMSPropOptimizer(
        learning_rate,
        decay=FLAGS.rmsprop_decay,
        momentum=FLAGS.rmsprop_momentum,
        epsilon=FLAGS.opt_epsilon)
  elif FLAGS.optimizer == 'sgd':
    optimizer = tf.train.GradientDescentOptimizer(learning_rate)
  elif FLAGS.optimizer == 'yellowfin':
    optimizer = YFOptimizer(lr=1.0, mu=0.0)
  else:
    raise ValueError('Optimizer [%s] was not recognized', FLAGS.optimizer)
  return optimizer
def _configure_optimizer ( learning_rate ) : if FLAGS . optimizer == 'adadelta' : optimizer = tf . train . AdadeltaOptimizer ( learning_rate , rho = FLAGS . adadelta_rho , epsilon = FLAGS . opt_epsilon ) elif FLAGS . optimizer == 'adagrad' : optimizer = tf . train . AdagradOptimizer ( learning_rate , initial_accumulator_value = FLAGS . adagrad_initial_accumulator_value ) elif FLAGS . optimizer == 'adam' : optimizer = tf . train . AdamOptimizer ( learning_rate , beta1 = FLAGS . adam_beta1 , beta2 = FLAGS . adam_beta2 , epsilon = FLAGS . opt_epsilon ) elif FLAGS . optimizer == 'ftrl' : optimizer = tf . train . FtrlOptimizer ( learning_rate , learning_rate_power = FLAGS . ftrl_learning_rate_power , initial_accumulator_value = FLAGS . ftrl_initial_accumulator_value , l1_regularization_strength = FLAGS . ftrl_l1 , l2_regularization_strength = FLAGS . ftrl_l2 ) elif FLAGS . optimizer == 'momentum' : optimizer = tf . train . MomentumOptimizer ( learning_rate , momentum = FLAGS . momentum , name = 'Momentum' ) elif FLAGS . optimizer == 'rmsprop' : optimizer = tf . train . RMSPropOptimizer ( learning_rate , decay = FLAGS . rmsprop_decay , momentum = FLAGS . rmsprop_momentum , epsilon = FLAGS . opt_epsilon ) elif FLAGS . optimizer == 'sgd' : optimizer = tf . train . GradientDescentOptimizer ( learning_rate ) elif FLAGS . optimizer == 'yellowfin' : optimizer = YFOptimizer ( lr = 1.0 , mu = 0.0 ) else : raise ValueError ( 'Optimizer [%s] was not recognized' , FLAGS . optimizer ) return optimizer