8000 [BE][Easy] enable postponed annotations in `torchgen` by XuehaiPan · Pull Request #129376 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[BE][Easy] enable postponed annotations in torchgen #129376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
Prev Previous commit
Next Next commit
Update
[ghstack-poisoned]
  • Loading branch information
XuehaiPan committed Jun 28, 2024
commit b6b813937f9522c50225a4b435a901b74a194f75
13 changes: 6 additions & 7 deletions torchgen/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import functools
import json
import os
import pathlib
from collections import defaultdict, namedtuple, OrderedDict
from dataclasses import dataclass, field
from pathlib import Path
Expand Down Expand Up @@ -2706,12 +2705,12 @@ def gen_declarations_yaml(
)


def get_torchgen_root() -> pathlib.Path:
def get_torchgen_root() -> Path:
"""
If you're depending on torchgen out-of-tree, you can use the root to figure
out the path to native_functions.yaml
"""
return pathlib.Path(__file__).parent.resolve()
return Path(__file__).parent.resolve()


def main() -> None:
Expand Down Expand Up @@ -2873,11 +2872,11 @@ def main() -> None:
#
# Invalid character escape '\c'.
core_install_dir = f"{options.install_dir}/core"
pathlib.Path(core_install_dir).mkdir(parents=True, exist_ok=True)
Path(core_install_dir).mkdir(parents=True, exist_ok=True)
ops_install_dir = f"{options.install_dir}/ops"
pathlib.Path(ops_install_dir).mkdir(parents=True, exist_ok=True)
Path(ops_install_dir).mkdir(parents=True, exist_ok=True)
aoti_install_dir = f"{options.aoti_install_dir}"
pathlib.Path(aoti_install_dir).mkdir(parents=True, exist_ok=True)
Path(aoti_install_dir).mkdir(parents=True, exist_ok=True)

core_fm = make_file_manager(options=options, install_dir=core_install_dir)
cpu_fm = make_file_manager(options=options)
Expand Down Expand Up @@ -2964,7 +2963,7 @@ def main() -> None:
gen_declarations_yaml(native_functions=native_functions, cpu_fm=cpu_fm)

if options.output_dependencies:
depfile_path = pathlib.Path(options.output_dependencies).resolve()
depfile_path = Path(options.output_dependencies).resolve()
depfile_name = depfile_path.name
depfile_stem = depfile_path.stem

Expand Down
3 changes: 1 addition & 2 deletions torchgen/gen_executorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import argparse
import os
import pathlib
from collections import defaultdict
from dataclasses import dataclass
from pathlib import Path
Expand Down Expand Up @@ -984,7 +983,7 @@ def main() -> None:
)

if options.output_dependencies:
depfile_path = pathlib.Path(options.output_dependencies).resolve()
depfile_path = Path(options.output_dependencies).resolve()
depfile_name = depfile_path.name
depfile_stem = depfile_path.stem

Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
0