'Creates the training operation'

def _build_train_op(self, loss):

    learning_rate_decay_fn = training_utils.create_learning_rate_decay_fn(decay_type=(self.params[u'optimizer.lr_decay_type'] or None), decay_steps=self.params[u'optimizer.lr_decay_steps'], decay_rate=self.params[u'optimizer.lr_decay_rate'], start_decay_at=self.params[u'optimizer.lr_start_decay_at'], stop_decay_at=self.params[u'optimizer.lr_stop_decay_at'], min_learning_rate=self.params[u'optimizer.lr_min_learning_rate'], staircase=self.params[u'optimizer.lr_staircase'])
    optimizer = self._create_optimizer()
    train_op = tf.contrib.layers.optimize_loss(loss=loss, global_step=tf.contrib.framework.get_global_step(), learning_rate=self.params[u'optimizer.learning_rate'], learning_rate_decay_fn=learning_rate_decay_fn, clip_gradients=self._clip_gradients, optimizer=optimizer, summaries=[u'learning_rate', u'loss', u'gradients', u'gradient_norm'])
    return train_op
