mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Refactor stack_trace preservation for node meta preservation (#90803)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/90803 Approved by: https://github.com/jerryzh168, https://github.com/albanD
This commit is contained in:
committed by
PyTorch MergeBot
parent
1e768c63c1
commit
0f1302eeae
@ -178,7 +178,7 @@ class TestFunctionalization(TestCase):
|
||||
from torch._functorch.aot_autograd import setup_stacktrace_preservation_hooks
|
||||
import torch.fx.traceback as fx_traceback
|
||||
setup_stacktrace_preservation_hooks([loss.grad_fn])
|
||||
with fx_traceback.override_stack_trace():
|
||||
with fx_traceback.preserve_node_meta():
|
||||
loss.backward()
|
||||
return x.grad
|
||||
|
||||
|
Reference in New Issue
Block a user