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 35ce68b commit 6656c71Copy full SHA for 6656c71
torch/autograd/grad_mode.py
@@ -111,7 +111,7 @@ class no_grad(_DecoratorContextManager):
111
112
Example::
113
114
- >>> x = torch.tensor([1], requires_grad=True)
+ >>> x = torch.tensor([1.], requires_grad=True)
115
>>> with torch.no_grad():
116
... y = x * 2
117
>>> y.requires_grad
@@ -206,7 +206,7 @@ class set_grad_enabled(_DecoratorContextManager):
206
207
208
209
210
>>> is_train = False
211
>>> with torch.set_grad_enabled(is_train):
212
0 commit comments