@@ -371,15 +371,15 @@ def model(x):
371371
372372 folder = Path (folder )
373373 folder .mkdir (exist_ok = True , parents = True )
374- if inputs == None :
374+ if inputs is None :
375375 inputs = self .example_input_meta
376376 has_cuda_args = any (hasattr (arg , "device" ) and arg .device .type == "cuda" for arg in inputs )
377377 has_requires_grad_args = any (hasattr (arg , "requires_grad" ) and arg .requires_grad for arg in inputs )
378378 torch_env , thunder_pkgs = get_env ()
379379 readable = _readable (self .graph , "DynamoModule" , print_output = False )
380380 # The packages that are likely to be used by the code generated from the Torch GraphModule
381381 torch_import_str = "\n " .join ([v .import_str for v in torch .fx .graph ._custom_builtins .values ()])
382- import_str = "" if import_str == None else "\n " .join (import_str )
382+ import_str = "" if import_str is None else "\n " .join (import_str )
383383 input_str = textwrap .indent (self ._get_input_str (folder , inputs , serialize_inputs ), " " )
384384 call_bench_str = f"benchmark_for_compute_type(compute_type, benchmark, compiled_model, inputs, {{}}, has_cuda={ True if has_cuda_args else False } )"
385385 compute_type_decorator = (
@@ -502,7 +502,7 @@ def write_repro(
502502 """
503503 folder = Path (folder )
504504 folder .mkdir (exist_ok = True , parents = True )
505- if inputs == None :
505+ if inputs is None :
506506 inputs = self .example_input_meta
507507 code_str = self ._get_repro_code (folder , compile_fn , None , serialize_inputs , inputs )
508508 comment_str = self ._get_comment_str (extra_comment_str )
@@ -602,7 +602,7 @@ def write_benchmark(
602602 """
603603 folder = Path (folder )
604604 folder .mkdir (exist_ok = True , parents = True )
605- if inputs == None :
605+ if inputs is None :
606606 inputs = self .example_input_meta
607607 forward_only = not any (hasattr (arg , "requires_grad" ) and arg .requires_grad for arg in inputs )
608608 code_str = self ._get_repro_code (folder , compile_fn , time_fn , serialize_inputs , inputs )
@@ -923,7 +923,7 @@ def write_nvfuser_benchmark(self, folder, time_fn: TimerInterface, file_name=Non
923923print(measurement)
924924{ comment_str }
925925"""
926- if file_name == None :
926+ if file_name is None :
927927 file_name = f"{ self .name } _benchmark_nvfuser.py"
928928 with open (folder / file_name , "w" ) as f :
929929 print (code_str , file = f )
@@ -936,7 +936,7 @@ def write_nvfuser_repro(self, folder, file_name=None):
936936 comment_str = f'"""\n { self .nvfusion_bsym } \n """'
937937 repro_code_str = f"{ repro_code_str } \n { comment_str } "
938938
939- if file_name == None :
939+ if file_name is None :
940940 file_name = f"{ self .name } _repro_nvfuser.py"
941941 with open (folder / file_name , "w" ) as f :
942942 print (repro_code_str , file = f )
@@ -966,7 +966,7 @@ def write_inductor_repro(self, folder: PathLike, file_name=None):
966966 code_str = f"""{ code_str }
967967out = torch_compiled_callable(*inputs)
968968"""
969- if file_name == None :
969+ if file_name is None :
970970 file_name = f"{ self .name } _repro_inductor.py"
971971 with open (folder / file_name , "w" ) as f :
972972 f .write (code_str )
@@ -982,7 +982,7 @@ def write_inductor_benchmark(self, folder: PathLike, time_fn: TimerInterface, fi
982982measurement = { time_fn .to_source ("torch_compiled_callable" , "inputs" )}
983983print(measurement)
984984"""
985- if file_name == None :
985+ if file_name is None :
986986 file_name = f"{ self .name } _benchmark_inductor.py"
987987 with open (folder / file_name , "w" ) as f :
988988 f .write (code_str )
0 commit comments