Skip to content

Commit

Permalink
Merge pull request #3125 from jinjiren/enalbe_freezing_unfreezing_wit…
Browse files Browse the repository at this point in the history
…h_resuming

Fix the problem with resuming training when switching the freezing layers
  • Loading branch information
beam2d committed Nov 6, 2017
2 parents 3e39a5f + 46b9131 commit 0772aaa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chainer/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ def serialize(self, serializer):

for key in self._state:
self._state[key] = serializer(key, None)
# leave the update rule state as `None` if the keys are not
# contained in the snapshot, so that these states can be
# automatically initialized with the `_prepare` method
if self._state[key] is None:
self._state = None
break
else:
for key in self._state:
self._state[key] = serializer(key, self._state[key])
Expand Down

0 comments on commit 0772aaa

Please sign in to comment.