'Creates the optimizer'

def _create_optimizer(self):

    name = self.params[u'optimizer.name']
    optimizer = tf.contrib.layers.OPTIMIZER_CLS_NAMES[name](learning_rate=self.params[u'optimizer.learning_rate'], **self.params[u'optimizer.params'])
    if (self.params[u'optimizer.sync_replicas'] > 0):
        optimizer = tf.train.SyncReplicasOptimizer(opt=optimizer, replicas_to_aggregate=self.params[u'optimizer.sync_replicas_to_aggregate'], total_num_replicas=self.params[u'optimizer.sync_replicas'])
        global_vars.SYNC_REPLICAS_OPTIMIZER = optimizer
    return optimizer
