Skip to content

Commit 2ce5875

Browse files
Magic-Bubblesoumith
authored andcommitted
Modify the sample code of extending autograd (pytorch#1720)
The original input can not be used as input of Linear(), because forward() takes at least 3 arguments (2 given)
1 parent 511cb20 commit 2ce5875

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/source/notes/extending.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ numerical approximations using small finite differences::
9595
# gradchek takes a tuple of tensor as input, check if your gradient
9696
# evaluated with these tensors are close enough to numerical
9797
# approximations and returns True if they all verify this condition.
98-
input = (Variable(torch.randn(20,20).double(), requires_grad=True),)
98+
input = (Variable(torch.randn(20,20).double(), requires_grad=True), Variable(torch.randn(30,20).double(), requires_grad=True),)
9999
test = gradcheck(Linear(), input, eps=1e-6, atol=1e-4)
100100
print(test)
101101

0 commit comments

Comments
 (0)