We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f8d4f98 commit 2d01f38Copy full SHA for 2d01f38
torch/nn/_functions/batchnorm.py
@@ -54,7 +54,8 @@ def backward(self, grad_output):
54
if (len(self.needs_input_grad) > 1 and self.needs_input_grad[2]) or self.use_cudnn:
55
grad_bias = bias.new(bias.size()).zero_()
56
57
- if self.use_cudnn:
+ if self.use_cudnn and self.training:
58
+ # cudnn does not support backward in evaluate mode
59
torch._C._cudnn_batch_norm_backward(
60
input, grad_output, grad_input,
61
grad_weight, grad_bias, weight,
0 commit comments