Ignored parameters without gradient in importance
@@ -124,6 +124,7 @@ class EWCPlugin(StrategyPlugin):
for (k1, p), (k2, imp) in zip(model.named_parameters(),
importances):
assert (k1 == k2)
+ if p.grad is not None:
imp += p.grad.data.clone().pow(2)
# average over mini batch length
