import tensorflow as tf

    train_op: op for training.
  """
   # Compute gradients.

  tf.scalar_summary(loss.op.name, loss)

  optimizer = tf.train.AdagradOptimizer(FLAGS.learning_rate)
  # Use the optimizer to apply the gradients that minimize the loss
  # (and also increment the global step counter) as a single training step.
  train_op = optimizer.minimize(loss, global_step=global_step)
  return train_op

