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:
Jeff Yang
2021-03-29 10:13:19 -07:00
committed by Facebook GitHub Bot
parent 6dedecc77c
commit 74e01c1dd9

View File

@ -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