Skip to content

Commit a9bf72e

Browse files
authored
Merge pull request #109 from lucasb-eyer/reinit
Add re-init util
2 parents e6a465b + 1fd2499 commit a9bf72e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

DeepFried2/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ def count_params(module, learnable_only=True):
4646
return sum(p.get_value().size for p in module.parameters(learnable_only=learnable_only))
4747

4848

49+
def reinit(module):
50+
for p in module.parameters():
51+
p.reinit()
52+
return module
53+
54+
4955
def flatten(what, types=(list, tuple), none_to_empty=False):
5056
if what is None and none_to_empty:
5157
return []

0 commit comments

Comments
 (0)