Enable trace through the collections module (#159365)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/159365
Approved by: https://github.com/zou3519
This commit is contained in:
Guilherme Leobas
2025-08-15 12:44:28 -03:00
committed by PyTorch MergeBot
parent 17de899709
commit 0242d40fa5
17 changed files with 7 additions and 4 deletions

View File

@ -1596,8 +1596,13 @@ class CatchErrorsWrapper:
)
return ConvertFrameReturn()
if frame.f_code.co_filename == "<string>" and frame.f_code.co_name == "__new__":
# nametuple constructor
if (
frame.f_code.co_filename == "<string>" and frame.f_code.co_name == "__new__"
) or (
frame.f_code.co_filename.endswith("collections/__init__.py")
and frame.f_code.co_name == "_make"
):
# nametuple constructor/_make
return ConvertFrameReturn()
if torch._dynamo.utils.get_optimize_ddp_mode() == "ddp_optimizer":
ddp_module = DistributedDataParallel._get_active_ddp_module()