Skip to content

Commit 73cd554

Browse files
Merge pull request #796 from analysiscenter/r0.9.3
v0.9.3
2 parents 062ca27 + 8be781e commit 73cd554

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

batchflow/models/torch/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,8 +815,9 @@ def setup_gradient_clipping(self):
815815
raise ValueError(f'gradient_clipping must be int, float or callable but it is{type(gradient_clipping)}')
816816

817817
for p in self.model.parameters():
818-
hook = p.register_hook(function)
819-
self._hooks.append(hook)
818+
if p.requires_grad:
819+
hook = p.register_hook(function)
820+
self._hooks.append(hook)
820821

821822
def setup_weights_averaging(self):
822823
""" Prepare WA-model: check all required keys and store copy on CPU. """

0 commit comments

Comments
 (0)