All problems
MAML Inner Loop Step
Problem
Run the MAML inner loop on one task by applying a sequence of gradient steps.
Starting from params, apply theta = theta - lr * grads for each gradient vector in grad_steps and return the adapted parameters. An empty grad_steps returns a copy of params.
Hint
These are the fast adaptation steps MAML differentiates through when computing the meta-gradient.
Test cases
case 1
in: [[1,2],[[0.5,-0.5]],0.1]
expected: [0.95,2.05]
case 2
in: [[0],[[1],[1]],0.5]
expected: [-1]
case 3
in: [[1],[],1]
expected: [1]
case 4
in: [[],[],0.5]
expected: []
Starter codePython
def maml_inner_loop(params, grad_steps, lr):
# Your code here
pass4 test cases · run your code against them in the editor