import math


def lr_func_cosine(base_lr, cur_epoch, num_optimizer_epochs):
    """
    Retrieve the learning rate of the current step using the cosine learning
    rate schedule.
    """
    return (
        base_lr
        * (math.cos(math.pi * cur_epoch / num_optimizer_epochs) + 1.0)
        * 0.5
    )