Skip to content

Commit 96568fe

Browse files
committed
Default Module.parameters always return params, regardless of mode.
1 parent e6a7ef0 commit 96568fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

DeepFried2/layers/Module.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ def zero_grad_parameters(self):
2222
def parameters(self):
2323
params, grads = [], []
2424

25-
if self.training_mode and hasattr(self, 'weight'):
25+
if hasattr(self, 'weight'):
2626
assert hasattr(self, 'grad_weight'), "The layer {} has a `weight` variable but no `grad_weight`, you probably forget to implement it.".format(type(self))
2727
params += [self.weight]
2828
grads += [self.grad_weight]
2929

30-
if self.training_mode and hasattr(self, 'bias'):
30+
if hasattr(self, 'bias'):
3131
assert hasattr(self, 'grad_bias'), "The layer {} has a `bias` variable but no `grad_bias`, you probably forget to implement it.".format(type(self))
3232
params += [self.bias]
3333
grads += [self.grad_bias]

0 commit comments

Comments
 (0)