Skip to content

Commit b9e00df

Browse files
gchanansoumith
authored andcommitted
Make (non-legacy) nn backwards compatible.
The keepdim change only seems to leak in one place: when the grad_bias is returned in linear.py.
1 parent f6a00fa commit b9e00df

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torch/nn/_functions/linear.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,6 @@ def backward(self, grad_output):
8282
grad_weight = torch.mm(buff.t(), input2)
8383

8484
if bias is not None and self.needs_input_grad[3]:
85-
grad_bias = grad_output.sum(0)
85+
grad_bias = grad_output.sum(0, True)
8686

8787
return grad_input1, grad_input2, grad_weight, grad_bias

0 commit comments

Comments
 (0)