'Train operation function for the given scope used file training.'

def get_train_op_for_scope(self, loss, optimizer, scopes):

    is_trainable = (lambda x: (x in tf.trainable_variables()))
    var_list = []
    update_ops = []
    for scope in scopes:
        var_list.extend(filter(is_trainable, tf.contrib.framework.get_model_variables(scope)))
        update_ops.extend(tf.get_collection(tf.GraphKeys.UPDATE_OPS, scope))
    return slim.learning.create_train_op(loss, optimizer, update_ops=update_ops, variables_to_train=var_list, clip_gradient_norm=self._params.clip_gradient_norm)
