All problems
Warm Restart Cosine Period Length
Problem
In cosine annealing with warm restarts, the i-th period length is T_i = T_0 * T_mult^i.
Given the base period T_0, the multiplier T_mult, and the restart index i, return the period length.
Hint
Periods grow geometrically when T_mult exceeds one.
Test cases
case 1
in: [10,1,3]
expected: 10
case 2
in: [10,2,3]
expected: 80
case 3
in: [100,0.5,2]
expected: 25
Starter codePython
def warm_restart_cosine_period_length(t0, t_mult, i):
# Your code here
pass3 test cases · run your code against them in the editor