mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE][Easy] replace import pathlib
with from pathlib import Path
(#129426)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/129426 Approved by: https://github.com/malfet
This commit is contained in:
committed by
PyTorch MergeBot
parent
2effbcfcd8
commit
4ee1cb9b95
@ -2,9 +2,9 @@ from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
import re
|
||||
from collections import Counter, defaultdict, namedtuple
|
||||
from pathlib import Path
|
||||
from typing import Sequence
|
||||
|
||||
import yaml
|
||||
@ -529,7 +529,7 @@ def run(
|
||||
source_yaml: str, output_dir: str, dry_run: bool, impl_path: str | None = None
|
||||
) -> None:
|
||||
# Assumes that this file lives at PYTORCH_ROOT/torchgen/gen_backend_stubs.py
|
||||
pytorch_root = pathlib.Path(__file__).parent.parent.absolute()
|
||||
pytorch_root = Path(__file__).parent.parent.absolute()
|
||||
template_dir = os.path.join(pytorch_root, "aten/src/ATen/templates")
|
||||
|
||||
def make_file_manager(install_dir: str) -> FileManager:
|
||||
|
@ -2,8 +2,8 @@ from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
from collections import namedtuple
|
||||
from pathlib import Path
|
||||
from typing import Any, Callable, Iterable, Iterator, Sequence
|
||||
|
||||
import yaml
|
||||
@ -252,7 +252,7 @@ def main() -> None:
|
||||
options = parser.parse_args()
|
||||
|
||||
# Assumes that this file lives at PYTORCH_ROOT/torchgen/gen_backend_stubs.py
|
||||
torch_root = pathlib.Path(__file__).parent.parent.parent.absolute()
|
||||
torch_root = Path(__file__).parent.parent.parent.absolute()
|
||||
aten_path = str(torch_root / "aten" / "src" / "ATen")
|
||||
lazy_ir_generator: type[GenLazyIR] = default_args.lazy_ir_generator
|
||||
if options.gen_ts_lowerings:
|
||||
|
Reference in New Issue
Block a user