[Meta Tensor] fix meta inplace set storage (#123880)

Fixes #123879

Co-authored-by: Edward Z. Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/123880
Approved by: https://github.com/ezyang
This commit is contained in:
Edward Z. Yang
2024-05-01 06:53:45 +00:00
committed by PyTorch MergeBot
parent c3c4465f50
commit c511aed27f
5 changed files with 146 additions and 77 deletions

View File

@ -1265,7 +1265,7 @@ class MetaConverter:
mb_fake_mode = maybe_get_fake_mode(r)
if mb_fake_mode is not None:
maybe_fake_mgr = in_kernel_invocation_manager(mb_fake_mode)
with maybe_fake_mgr, torch.no_grad():
with maybe_fake_mgr, torch.no_grad(), maybe_suppress():
r.set_(r_s, storage_offset, sizes, strides)
if t.grad is not None: