Skip to content

Views created in no_grad block still have requires_grad=True #11390

@ssnl

Description

@ssnl
>>> x = torch.randn(3, requires_grad=True)
>>> with torch.no_grad():
...   print(x[1])
...
tensor(-0.0967, requires_grad=True)

Metadata

Metadata

Assignees

Labels

module: autogradRelated to torch.autograd, and the autograd engine in generalmodule: docsRelated to our documentation, both in docs/ and docblockstriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions