Skip to content

Commit 555de3d

Browse files
author
AndreaCossu
committed
Fixed EWC bug in importances
1 parent 5064e77 commit 555de3d

File tree

1 file changed

+2
-2
lines changed
  • avalanche/training/plugins

1 file changed

+2
-2
lines changed

avalanche/training/plugins/ewc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def before_backward(self, strategy, **kwargs):
8989
# dynamic models may add new units
9090
# new units are ignored by the regularization
9191
n_units = saved_param.shape[0]
92-
cur_param = saved_param[:n_units]
92+
cur_param = cur_param[:n_units]
9393
penalty += (imp * (cur_param - saved_param).pow(2)).sum()
9494
elif self.mode == "online":
9595
prev_exp = exp_counter - 1
@@ -101,7 +101,7 @@ def before_backward(self, strategy, **kwargs):
101101
# dynamic models may add new units
102102
# new units are ignored by the regularization
103103
n_units = saved_param.shape[0]
104-
cur_param = saved_param[:n_units]
104+
cur_param = cur_param[:n_units]
105105
penalty += (imp * (cur_param - saved_param).pow(2)).sum()
106106
else:
107107
raise ValueError("Wrong EWC mode.")

0 commit comments

Comments
 (0)