Skip to content
DeepForgeby svx
All problems
EasyDeep Learningdl-289

Model Warmup Iterations

Problem

Compute how many warmup iterations are needed for latency to decay to the target: ceil(log(target / initial) / log(decay)). If the initial latency is already within budget, return 0.

The signature is model_warmup_iters(target_latency_ms, initial_latency_ms, decay). Return an integer.

Hint

Warmup lets caches, JIT compilation and clocks stabilize before measurement.

Test cases

case 1
in: [80,200,0.8]
expected: 5
case 2
in: [10,100,0.5]
expected: 4
case 3
in: [100,100,0.9]
expected: 0
case 4
in: [50,200,0.5]
expected: 2
Starter codePython
import math
def model_warmup_iters(target_latency_ms, initial_latency_ms, decay):
    # Your code here
    pass

4 test cases · run your code against them in the editor