How to calculate FIM for EWC ? #779
-
Hi everyone ! The first one was proposed here https://github.com/ContinualAI/colab/blob/master/notebooks/intro_to_continual_learning.ipynb. In the first one all data is passed to the model.forward and loss.backward is applied (and optimizer.zero_grad is never called). Instead in the second one, while data are forwarded the gradients of the current batch are saved in another variable, which accumulates gradients over time. My question is if in your opinion these two versions can be considered equivalent and therefore they can be both used. First version
Second version
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Avalanche does an average at the end:
while the colab version does not. Apart from that, they are basically equivalent. Notice that, to really compute the FIM, you should have |
Beta Was this translation helpful? Give feedback.
Avalanche does an average at the end:
while the colab version does not. Apart from that, they are basically equivalent.
Notice that, to really compute the FIM, you should have
batch_size=1
. In practice,batch_size>1
works as well and it is much more efficient.