optimizer = tf.train.**(learning_rate) global_step = tf.Variable(0, trainable=False, name='global_step') train_op = optimizer.minimize(loss, global_step=global_step)