Skip to content

Commit

Permalink
Add MER strategy [PEP8 fix]
Browse files Browse the repository at this point in the history
  • Loading branch information
HamedHemati committed Nov 26, 2022
1 parent 55dc7c7 commit 9328ad6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions avalanche/training/supervised/mer.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,16 @@ def _inner_updates(self, **kwargs):
# Within-batch Reptile update
w_aft_t = self.model.state_dict()
self.model.load_state_dict(
{name: w_bef_t[name] +
((w_aft_t[name] - w_bef_t[name]) * self.beta)
{name: w_bef_t[name] + ((w_aft_t[name] - w_bef_t[name])
* self.beta)
for name in w_bef_t}
)

def _outer_update(self, **kwargs):
w_aft = self.model.state_dict()
self.model.load_state_dict(
{name: self.w_bef[name] +
((w_aft[name] - self.w_bef[name]) * self.gamma)
for name in self.w_bef}
{name: self.w_bef[name] + ((w_aft[name] - self.w_bef[name])
* self.gamma) for name in self.w_bef}
)
with torch.no_grad():
pred = self.forward()
Expand Down
2 changes: 1 addition & 1 deletion avalanche/training/templates/common_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,4 +450,4 @@ def __init__(
#
# This dataset may contain samples from different experiences. If you
# want the original data for the current experience
# use :attr:`.BaseTemplate.experience`.
# use :attr:`.BaseTemplate.experience`.

0 comments on commit 9328ad6

Please sign in to comment.