Fix unused Python variables outside torch/ and test/ (#136359)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/136359
Approved by: https://github.com/albanD
This commit is contained in:
Tom Ritchford
2024-12-11 14:00:52 +00:00
committed by PyTorch MergeBot
parent 241bf047b3
commit 498a7808ff
49 changed files with 39 additions and 86 deletions

View File

@ -317,7 +317,6 @@ def get_upgrader_bytecode_function_to_index_map(
def write_cpp(cpp_path: str, upgrader_dict: list[dict[str, Any]]) -> None:
body_parts = []
upgrader_bytecode_function_to_index_map = (
get_upgrader_bytecode_function_to_index_map(upgrader_dict)
)
@ -335,7 +334,6 @@ def write_cpp(cpp_path: str, upgrader_dict: list[dict[str, Any]]) -> None:
operator_list_str = ""
for table_name, contents in bytecode.items():
element = ByteCode[table_name]
body_string = ""
if element is ByteCode.instructions:
instruction_list_str = construct_instruction(contents)
elif element is ByteCode.constants:
@ -364,10 +362,8 @@ def write_cpp(cpp_path: str, upgrader_dict: list[dict[str, Any]]) -> None:
operator_version_map=version_map_src,
upgrader_bytecode="".join(all_upgrader_src_string).lstrip("\n"),
)
body_parts.append(upgrader_file_content)
print("writing file to : ", cpp_path + "/" + UPGRADER_MOBILE_FILE_NAME)
with open(os.path.join(cpp_path, UPGRADER_MOBILE_FILE_NAME), "wb") as out_file:
final_output = "".join(body_parts)
out_file.write(upgrader_file_content.encode("utf-8"))