import math


def cosine_decay(base_lr, max_iteration, cur_step):
    """cosine learning rate decay
    
    cosine learning rate decay with parameters proposed FixMatch
    base_lr * cos( (7\pi cur_step) / (16 max_warmup_iter) )

    Parameters
    -----
    base_lr: float
        maximum learning rate
    max_warmup_iter: int
        maximum warmup iteration
    cur_step: int
        current iteration
    """
    return base_lr * (math.cos( (7*math.pi*cur_step) / (16*max_iteration) ))