-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
better-engineeringRelatively self-contained tasks for better engineering contributorsRelatively self-contained tasks for better engineering contributorsmodule: autogradRelated to torch.autograd, and the autograd engine in generalRelated to torch.autograd, and the autograd engine in generalmodule: correctness (silent)issue that returns an incorrect result silentlyissue that returns an incorrect result silentlysmallWe think this is a small issue to fix. Consider knocking off high priority small issuesWe think this is a small issue to fix. Consider knocking off high priority small issuestriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
As per title.
Example failing code that generates potentially wrong gradients:
import torch
a = torch.rand(10, requires_grad=True).clone()
# View for which inplace are invalid
b = a.unbind(0)
# Chain of view where the last one is valid for inplace
c = b[0].view_as(b[0])
# This one should fail but does not
c.mul_(2)
# This one properly fails
b.mul_(2)
In general, the CreationMeta should be inherited from the previous view to ensure invalid chain of views are properly forbidden.
cc @ezyang @albanD @zou3519 @gqchen @pearu @nikitaved @soulitzer
Metadata
Metadata
Assignees
Labels
better-engineeringRelatively self-contained tasks for better engineering contributorsRelatively self-contained tasks for better engineering contributorsmodule: autogradRelated to torch.autograd, and the autograd engine in generalRelated to torch.autograd, and the autograd engine in generalmodule: correctness (silent)issue that returns an incorrect result silentlyissue that returns an incorrect result silentlysmallWe think this is a small issue to fix. Consider knocking off high priority small issuesWe think this is a small issue to fix. Consider knocking off high priority small issuestriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module