You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
🐛 [Bug] With enable_autocast, an in-place update is lost through a view taken before it #4990
With enable_autocast=True, an in-place update can be lost when a view of the same tensor was taken before it. In the example below, the view keeps the value from before add_. The default path (no autocast) gives the right answer, and a plain in-place op with no view, such as relu_, also works.
This comes from #4978 (not merged yet). Without it, the autocast output is correct.
z should see the add_, so the answer is [4.0, -2.0]. The autocast engine returns [2.0, -4.0], which is z before the add.
Expected behavior
The autocast engine matches PyTorch. When autocast changes the type of a tensor, every view of that tensor and every in-place update to it should stay together. Simply skipping views and in-place ops in the autocast pass is not enough, because that breaks existing autocast tests.
Activity