mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
docs: change to FloatTensor for requires_grad=True
(#54658)
Summary: fixes https://github.com/pytorch/pytorch/issues/54506 Pull Request resolved: https://github.com/pytorch/pytorch/pull/54658 Reviewed By: ailzhang Differential Revision: D27328321 Pulled By: zou3519 fbshipit-source-id: d29fa266a1cb2b6d8566055dfb6ce001edde9d96
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6dedecc77c
commit
74e01c1dd9
@ -138,7 +138,7 @@ class enable_grad(_DecoratorContextManager):
|
||||
|
||||
Example::
|
||||
|
||||
>>> x = torch.tensor([1], requires_grad=True)
|
||||
>>> x = torch.tensor([1.], requires_grad=True)
|
||||
>>> with torch.no_grad():
|
||||
... with torch.enable_grad():
|
||||
... y = x * 2
|
||||
|
Reference in New Issue
Block a user