def openai(base_lr, num_processed_images, num_epochs, num_warmup_epochs):
    """
    Learning rate scheduling strategy from openai/glow

    :param base_lr: base learning rate
    :type base_lr: float
    :param num_processed_images: number of processed images
    :type num_processed_images: int
    :param num_epochs: number of total epochs to train
    :type num_epochs: int
    :param num_warmup_epochs: number of epochs to warm up
    :type num_warmup_epochs: int
    :return: scheduled learning rate
    :rtype: float
    """
    lr = base_lr * min(1., num_processed_images / (num_epochs * num_warmup_epochs))
    return lr