Skip to content

Commit e60829a

Browse files
clee2000facebook-github-bot
authored andcommitted
Enable possibly-undefined error code (#118533)
Summary: Fixes pytorch/pytorch#118129 Suppressions automatically added with ``` import re with open("error_file.txt", "r") as f: errors = f.readlines() error_lines = {} for error in errors: match = re.match(r"(.*):(\d+):\d+: error:.*\[(.*)\]", error) if match: file_path, line_number, error_type = match.groups() if file_path not in error_lines: error_lines[file_path] = {} error_lines[file_path][int(line_number)] = error_type for file_path, lines in error_lines.items(): with open(file_path, "r") as f: code = f.readlines() for line_number, error_type in sorted(lines.items(), key=lambda x: x[0], reverse=True): code[line_number - 1] = code[line_number - 1].rstrip() + f" # type: ignore[{error_type}]\n" with open(file_path, "w") as f: f.writelines(code) ``` Signed-off-by: Edward Z. Yang <[email protected]> X-link: pytorch/pytorch#118533 Approved by: https://github.com/Skylion007, https://github.com/zou3519 Reviewed By: kit1980 Differential Revision: D53250766 Pulled By: clee2000 fbshipit-source-id: 7e54a878bf842a957c79c236e392fa4e38f3b216 Co-authored-by: Catherine Lee <[email protected]>
1 parent 4aa54b2 commit e60829a

File tree

1 file changed

+2
-2
lines changed
  • userbenchmark/dynamo/dynamobench/_dynamo

1 file changed

+2
-2
lines changed

userbenchmark/dynamo/dynamobench/_dynamo/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ def preserve_rng_state():
773773
with torch.utils._python_dispatch._disable_current_modes():
774774
torch.random.set_rng_state(rng_state)
775775
if torch.cuda.is_available():
776-
torch.cuda.set_rng_state(cuda_rng_state)
776+
torch.cuda.set_rng_state(cuda_rng_state) # type: ignore[possibly-undefined]
777777

778778

779779
def is_jit_model(model0):
@@ -892,7 +892,7 @@ def timed(model, example_inputs, times=1):
892892
result = model(*example_inputs)
893893
synchronize()
894894
t1 = time.perf_counter()
895-
return result, t1 - t0
895+
return result, t1 - t0 # type: ignore[possibly-undefined]
896896

897897

898898
def check_is_cuda(gm, example_inputs):

0 commit comments

Comments
 (0)