[BE] remove duplicates in generated torch._VF.__all__ (#157365)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/157365
Approved by: https://github.com/Skylion007
This commit is contained in:
Xuehai Pan
2025-07-01 22:57:17 +08:00
committed by PyTorch MergeBot
parent c78fce9e79
commit b146e1a264

View File

@ -1737,10 +1737,10 @@ def gen_pyi(
# Include only the functions that contain hints, to prevent undefined
# symbols to be included in the `__all__` directive.
hinted_function_names = [
hinted_function_names = {
name for name, hint in unsorted_function_hints.items() if hint
]
all_symbols = sorted(list(structseqs) + hinted_function_names)
}
all_symbols = sorted(hinted_function_names.union(structseqs))
all_directive = [
"__all__ = [",
*(f' "{name}",' for name in all_symbols),