Make the name assert actually do something, and reserve some more names (#157342)

Signed-off-by: Edward Yang <ezyang@meta.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/157342
Approved by: https://github.com/albanD
This commit is contained in:
Edward Yang
2025-06-30 22:20:19 -04:00
committed by PyTorch MergeBot
parent db188503cb
commit 6442ae9256

View File

@ -1235,12 +1235,16 @@ def trace_structured(
payload is an arbitrary string, which can be arbitrarily long (but expected to have
newlines so no lines are too long)
"""
assert "name" not in [
assert name not in [
"rank",
"compiled_autograd_id",
"frame_id",
"frame_compile_id",
"attempt",
"severity",
"timestamp",
"pathname",
"thread",
]
assert callable(metadata_fn), (
f"metadata_fn should be callable, but got {type(metadata_fn)}"