diff --git a/build_tools/autogen_ltc_backend.py b/build_tools/autogen_ltc_backend.py
index 6f6fd5e89..13753a6d5 100644
--- a/build_tools/autogen_ltc_backend.py
+++ b/build_tools/autogen_ltc_backend.py
@@ -30,6 +30,7 @@ if not TORCH_INCLUDE_DIR.is_dir():
TORCHGEN_DIR = Path(torchgen.__path__[0]).resolve()
TORCH_MLIR_DIR = Path(__file__).resolve().parent.parent
+
def reindent(text, prefix=""):
return indent(dedent(text), prefix)
@@ -75,7 +76,11 @@ class GenMlirLazyIr(torchgen.dest.GenLazyIR):
)
# Only create this variable if it's used to avoid Wunused-variable
- operand_idx_counter = "size_t i = 0;" if "i++" in (emplace_arguments_str + emplace_kwarguments) else ""
+ operand_idx_counter = (
+ "size_t i = 0;"
+ if "i++" in (emplace_arguments_str + emplace_kwarguments)
+ else ""
+ )
return reindent(
f"""
@@ -111,12 +116,16 @@ class GenTorchMlirLTC:
)
assert self.torch_ops_file.exists()
self.binary_dir = Path(binary_dir)
- assert self.binary_dir.is_dir(), f"Binary directory not found: {self.binary_dir}"
+ assert (
+ self.binary_dir.is_dir()
+ ), f"Binary directory not found: {self.binary_dir}"
self.source_yaml = self.binary_dir.joinpath("generated_native_functions.yaml")
self.backend_path = TORCH_MLIR_DIR.joinpath(
"projects", "ltc", "csrc", "base_lazy_backend"
)
- assert self.backend_path.is_dir(), f"Backend path not found: {self.backend_path}"
+ assert (
+ self.backend_path.is_dir()
+ ), f"Backend path not found: {self.backend_path}"
self.generated_path = self.binary_dir.joinpath(
"projects", "ltc", "csrc", "base_lazy_backend", "generated"
)
@@ -168,8 +177,9 @@ class GenTorchMlirLTC:
if ts_native_yaml_path.exists():
ts_native_yaml = yaml.load(ts_native_yaml_path.read_text(), yaml.CLoader)
else:
- logging.warning(f"Could not find `ts_native_functions.yaml` at {ts_native_yaml_path}")
-
+ logging.warning(
+ f"Could not find `ts_native_functions.yaml` at {ts_native_yaml_path}"
+ )
parsed_yaml = parse_native_yaml(native_yaml_path, tags_yaml_path)
self.native_functions = parsed_yaml.native_functions
diff --git a/build_tools/scrape_releases.py b/build_tools/scrape_releases.py
index b8c7265d3..88f19d92b 100644
--- a/build_tools/scrape_releases.py
+++ b/build_tools/scrape_releases.py
@@ -9,19 +9,20 @@ import requests
# Parse arguments
parser = argparse.ArgumentParser()
-parser.add_argument('owner', type=str)
-parser.add_argument('repo', type=str)
+parser.add_argument("owner", type=str)
+parser.add_argument("repo", type=str)
args = parser.parse_args()
# Get releases
response = requests.get(
- f"https://api.github.com/repos/{args.owner}/{args.repo}/releases")
+ f"https://api.github.com/repos/{args.owner}/{args.repo}/releases"
+)
body = json.loads(response.content)
# Parse releases
releases = []
for row in body:
- for asset in row['assets']:
+ for asset in row["assets"]:
releases.append((asset["name"], asset["browser_download_url"]))
# Output HTML
@@ -33,4 +34,4 @@ for name, url in releases:
html += f" {name}
\n"
html += """