import math


def cosine_annealing_lr(
    iteration: int,
    num_iterations: int,
    initial_lr: float,
    final_lr: float,
):
    """
    Cosine annealing NO restarts

    Args:
        iteration: current iteration
        num_iterations: total number of iterations of coine lr
        initial_lr: learning rate to start
        final_lr: learning rate to end

    Returns:
        float: learning rate
    """
    return final_lr + 0.5 * (initial_lr - final_lr) * (1 + \
        math.cos(math.pi * float(iteration) / float(num_iterations)))