The original code for the paper "How to train your MAML" along with a replication of the original "Model Agnostic Meta Learning" (MAML) paper in Pytorch.
I found the call of self.optimizer.zero_grad() and self.zero_grad() after self.meta_update(loss=losses['loss']), what is the purpose of them? It seems like self.optimizer.zero_grad() was already called in self.meta_update(loss=losses['loss']). As for self.zero_grad(), I couldn't get the aim of it. Could you please explain them? Thanks a lot!
I found the call of
self.optimizer.zero_grad()
andself.zero_grad()
afterself.meta_update(loss=losses['loss'])
, what is the purpose of them? It seems likeself.optimizer.zero_grad()
was already called inself.meta_update(loss=losses['loss'])
. As forself.zero_grad()
, I couldn't get the aim of it. Could you please explain them? Thanks a lot!