Skip to content

Commit 6656c71

Browse files

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

torch/autograd/grad_mode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class no_grad(_DecoratorContextManager):
111111
112112
Example::
113113
114-
>>> x = torch.tensor([1], requires_grad=True)
114+
>>> x = torch.tensor([1.], requires_grad=True)
115115
>>> with torch.no_grad():
116116
... y = x * 2
117117
>>> y.requires_grad
@@ -206,7 +206,7 @@ class set_grad_enabled(_DecoratorContextManager):
206206
207207
Example::
208208
209-
>>> x = torch.tensor([1], requires_grad=True)
209+
>>> x = torch.tensor([1.], requires_grad=True)
210210
>>> is_train = False
211211
>>> with torch.set_grad_enabled(is_train):
212212
... y = x * 2

0 commit comments

Comments
 (0)