Skip to content

Commit 1fd2499

Browse files
committed
Add re-init util
1 parent 6ade78b commit 1fd2499

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
@@ -41,6 +41,12 @@ def count_params(module, learnable_only=True):
4141
return sum(p.get_value().size for p in module.parameters(learnable_only=learnable_only))
4242

4343

44+
def reinit(module):
45+
for p in module.parameters():
46+
p.reinit()
47+
return module
48+
49+
4450
def flatten(what, types=(list, tuple), none_to_empty=False):
4551
if what is None and none_to_empty:
4652
return []

0 commit comments

Comments
 (0)