openai / supervised-reptile

Code for the paper "On First-Order Meta-Learning Algorithms"
https://arxiv.org/abs/1803.02999
MIT License
989 stars 210 forks source link

Question reagarding the mata gradient computation. #32

Closed SenHanami closed 3 years ago

SenHanami commented 3 years ago

83th line in meta.py:

# Compute the meta gradient and return it, the gradient is from one episode
# in metalearner, it will merge all loss from different episode and sum over it.
loss, pred = self.net_pi(query_x, query_y)
grads_pi = autograd.grad(loss, self.net_pi.parameters(), create_graph=True)

should't the meta grad be (grad_of_net_pi - grad_of_net)?