TorchedUp
LearnBetaProblemsSystem DesignSoonPremium
TorchedUp
LearnBetaProblemsSystem DesignSoonPremium
←

15. Cosine Annealing LR

Easy

Implement the cosine annealing learning rate schedule.

Signature: def cosine_lr(t: int, T: int, lr_max: float, lr_min: float = 0.0) -> float

Return the learning rate at step t given total steps T.

Math

ηt​=ηmin​+21​(ηmax​−ηmin​)(1+cosTπt​)

Asked at

Python 30/10 runs today

Output

Anything you print() in your code will show up here after you click Run.

Test Results

○t=0 start
○t=T/2 midpoint
○t=T end🔒 Premium