def swa_lr_decay(step: int, cycle_len: int, start_lr: float, end_lr: float) -> float:
    """ Linearly decrease the learning rate over the cycle. """
    return start_lr + ((end_lr - start_lr) / cycle_len) * (step % cycle_len)