Skip to content
DeepForgeby svx
All problems
MediumOptimizationop-347

Lookahead Interpolation Step

Problem

The Lookahead optimizer moves the slow weights toward the fast weights: slow_new = slow + alpha * (fast - slow).

Given the slow weights, fast weights, and alpha, return the updated slow weights.

Hint

Interpolate between the two parameter copies.

Test cases

case 1
in: [[0,0],[2,4],0.5]
expected: [1,2]
case 2
in: [[1,1],[1,1],0.9]
expected: [1,1]
case 3
in: [[0],[10],0.25]
expected: [2.5]
Starter codePython
def lookahead_interpolation_step(slow, fast, alpha):
    # Your code here
    pass

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