def _constant_schedule(epoch: int, start_epoch: int, swa_lr: float, init_lr: float) -> float:
    """
    Calculate the updated learning rate which change by constant factor each step.
    :return: updated learning rate
    :rtype: float
    :param epoch: current epoch
    :param start_epoch:  start epoch for SWAG
    :param swa_lr: min lr for SWAG
    :param init_lr: initial optimizer lr
    """
    t = epoch / start_epoch
    lr_ratio = swa_lr / init_lr
    if t <= 0.5:
        factor = 1.0
    elif t <= 0.9:
        factor = 1.0 - (1.0 - lr_ratio) * (t - 0.5) / 0.4
    else:
        factor = lr_ratio
    return init_lr * factor