4242 NoReturn ,
4343 Optional ,
4444 Sequence ,
45- Tuple ,
4645 TYPE_CHECKING ,
4746 TypeVar ,
4847 Union ,
@@ -375,7 +374,7 @@ def code_hash(code: Union[str, bytes], extra: str = "") -> str:
375374
376375def get_path (
377376 basename : str , extension : str , specified_dir : str = ""
378- ) -> Tuple [str , str , str ]:
377+ ) -> tuple [str , str , str ]:
379378 if specified_dir :
380379 if os .path .isabs (specified_dir ):
381380 subdir = specified_dir
@@ -403,7 +402,7 @@ def write(
403402 extra : str = "" ,
404403 hash_type : str = "code" ,
405404 specified_dir : str = "" ,
406- ) -> Tuple [str , str ]:
405+ ) -> tuple [str , str ]:
407406 # use striped content to compute hash so we don't end up with different
408407 # hashes just because the content begins/ends with different number of
409408 # spaces.
@@ -527,7 +526,7 @@ def __init__(
527526
528527 def _reduce_fake_tensor (
529528 self , t : Tensor
530- ) -> Tuple [Callable [[T ], T ], Tuple [TensorMetadata ]]:
529+ ) -> tuple [Callable [[T ], T ], tuple [TensorMetadata ]]:
531530 """
532531 Custom reducer to pickle FakeTensors.
533532 """
@@ -537,7 +536,7 @@ def _reduce_fake_tensor(
537536 def _reduce_tensor (
538537 self ,
539538 t : Tensor ,
540- ) -> Tuple [Callable [[T ], T ], Tuple [Union [TensorMetadata , TensorMetadataAndValues ]]]:
539+ ) -> tuple [Callable [[T ], T ], tuple [Union [TensorMetadata , TensorMetadataAndValues ]]]:
541540 """
542541 Custom reducer to pickle Tensors. If we see tensors, we know they're constants
543542 stored as attributes on the GraphModule.
@@ -570,7 +569,7 @@ def _reduce_tensor(
570569 # Otherwise, we just include the metadata.
571570 return (_ident , (metadata ,))
572571
573- def _reduce_symint (self , s : SymInt ) -> Tuple [Callable [[T ], T ], Tuple [str ]]:
572+ def _reduce_symint (self , s : SymInt ) -> tuple [Callable [[T ], T ], tuple [str ]]:
574573 """
575574 Custom reducer to pickle SymInts.
576575 """
@@ -588,7 +587,7 @@ def _reduce_unsupported(self, s: Any) -> NoReturn:
588587
589588 def _reduce_graph_module (
590589 self , gm : torch .fx .GraphModule
591- ) -> Tuple [Any , Tuple [Dict [str , Any ], str ]]:
590+ ) -> tuple [Any , tuple [Dict [str , Any ], str ]]:
592591 """
593592 Custom reducer for graph module to handle irrelevant data for user
594593 defined triton kernels
@@ -860,7 +859,7 @@ def compiled_fx_graph_hash(
860859 example_inputs : Sequence [InputType ],
861860 fx_kwargs : _CompileFxKwargs ,
862861 inputs_to_check : Sequence [int ],
863- ) -> Tuple [str , List [str ]]:
862+ ) -> tuple [str , List [str ]]:
864863 """
865864 Generate a unique hash of the FX graph for caching.
866865 """
@@ -980,7 +979,7 @@ def _lookup_graph(
980979 local : bool ,
981980 remote_cache : Optional [RemoteCache [JsonDataTy ]],
982981 constants : CompiledFxGraphConstants ,
983- ) -> Tuple [Optional [CompiledFxGraph ], Dict [str , Any ]]:
982+ ) -> tuple [Optional [CompiledFxGraph ], Dict [str , Any ]]:
984983 """
985984 Lookup a compiled graph in the cache by key. On a hit, return the
986985 deserialized CompiledFxGraph object. On a miss, return None.
@@ -1222,7 +1221,7 @@ def prepare_key(
12221221 fx_kwargs : _CompileFxKwargs ,
12231222 inputs_to_check : Sequence [int ],
12241223 remote : bool ,
1225- ) -> Tuple [Optional [Tuple [str , List [str ]]], Dict [str , Any ]]:
1224+ ) -> tuple [Optional [tuple [str , List [str ]]], Dict [str , Any ]]:
12261225 """
12271226 Checks that the inductor input is cacheable, then computes
12281227 and returns the cache key for the input.
@@ -1274,7 +1273,7 @@ def load_with_key(
12741273 remote_cache : Optional [RemoteCache [JsonDataTy ]],
12751274 is_backward : bool ,
12761275 constants : CompiledFxGraphConstants ,
1277- ) -> Tuple [Optional [CompiledFxGraph ], Dict [str , Any ]]:
1276+ ) -> tuple [Optional [CompiledFxGraph ], Dict [str , Any ]]:
12781277 """
12791278 Lookup the graph with the given key, and return results and metadata.
12801279 Doesn't do any logging on its own, because AOTAutograd handles a cache miss
@@ -1347,7 +1346,7 @@ def run_command_and_check(cmd_: str) -> None:
13471346
13481347
13491348@functools .lru_cache (None )
1350- def split_aot_inductor_output_path (path : str ) -> Tuple [str , str ]:
1349+ def split_aot_inductor_output_path (path : str ) -> tuple [str , str ]:
13511350 """Returns the path where the AOT Inductor compiled kernels are stored."""
13521351 if path .endswith (".so" ):
13531352 return os .path .split (path )
@@ -2720,18 +2719,18 @@ class PyCodeCache:
27202719 # than once, but attach different attributes, i.e., due to different
27212720 # constant values.
27222721 modules : List [ModuleType ] = []
2723- linemaps : Dict [str , List [Tuple [Any , ...]]] = {}
2722+ linemaps : Dict [str , List [tuple [Any , ...]]] = {}
27242723
27252724 @classmethod
2726- def write (cls , source_code : str , extra : str = "" ) -> Tuple [str , str ]:
2725+ def write (cls , source_code : str , extra : str = "" ) -> tuple [str , str ]:
27272726 return write (source_code , "py" , extra = extra )
27282727
27292728 @classmethod
27302729 def load (
27312730 cls ,
27322731 source_code : str ,
27332732 extra : str = "" ,
2734- linemap : Optional [List [Tuple [int , str ]]] = None ,
2733+ linemap : Optional [List [tuple [int , str ]]] = None ,
27352734 attrs : Optional [Dict [str , Any ]] = None ,
27362735 ) -> ModuleType :
27372736 key , path = write (source_code , "py" , extra = extra )
@@ -2742,7 +2741,7 @@ def load_by_key_path(
27422741 cls ,
27432742 key : str ,
27442743 path : str ,
2745- linemap : Optional [List [Tuple [int , str ]]] = None ,
2744+ linemap : Optional [List [tuple [int , str ]]] = None ,
27462745 attrs : Optional [Dict [str , Any ]] = None ,
27472746 ) -> ModuleType :
27482747 if linemap is None :
@@ -3043,7 +3042,7 @@ class CacheEntry:
30433042 _SOURCE_CODE_SUFFIX = "cu"
30443043
30453044 @classmethod
3046- def write (cls , source_code : str , dst_file_ext : str ) -> Tuple [str , str ]:
3045+ def write (cls , source_code : str , dst_file_ext : str ) -> tuple [str , str ]:
30473046 """
30483047 Writes source code into a file with dst_file_ext as the file extension.
30493048 Returns the hash key of source code, and the path to the file.
@@ -3060,7 +3059,7 @@ def write(cls, source_code: str, dst_file_ext: str) -> Tuple[str, str]:
30603059 @classmethod
30613060 def compile (
30623061 cls , source_code : str , dst_file_ext : str , extra_args : Optional [List [str ]] = None
3063- ) -> Tuple [str , str , str ]:
3062+ ) -> tuple [str , str , str ]:
30643063 """
30653064 Compiles CUDA source_code into a file with dst_file_ext extension.
30663065 Returns a tuple of dst_file_path, hash_key, source_code_path
@@ -3099,7 +3098,7 @@ def compile(
30993098 return (cls .cache [key ].output_path , key , input_path )
31003099
31013100 @classmethod
3102- def load (cls , source_code : str , dst_file_ext : str ) -> Tuple [DLLWrapper , str , str ]:
3101+ def load (cls , source_code : str , dst_file_ext : str ) -> tuple [DLLWrapper , str , str ]:
31033102 """
31043103 Compiles source code and loads the generated .so file.
31053104 Returns a tuple of DLLWrapper, hash_key, source_code_path
@@ -3129,7 +3128,7 @@ class CacheEntry:
31293128 _logged_compiler_version = False
31303129
31313130 @classmethod
3132- def write (cls , source_code : str , dst_file_ext : str ) -> Tuple [str , str ]:
3131+ def write (cls , source_code : str , dst_file_ext : str ) -> tuple [str , str ]:
31333132 """
31343133 Writes source code into a file with dst_file_ext as the file extension.
31353134 Returns the hash key of source code, and the path to the file.
@@ -3146,7 +3145,7 @@ def write(cls, source_code: str, dst_file_ext: str) -> Tuple[str, str]:
31463145 @classmethod
31473146 def compile (
31483147 cls , source_code : str , dst_file_ext : str , extra_args : Optional [List [str ]] = None
3149- ) -> Tuple [str , str , str ]:
3148+ ) -> tuple [str , str , str ]:
31503149 """
31513150 Compiles source_code into a file with dst_file_ext extension,
31523151 using the compile command specific for the ROCm platform.
@@ -3194,7 +3193,7 @@ def compile(
31943193 return (cls .cache [key ].output_path , key , input_path )
31953194
31963195 @classmethod
3197- def load (cls , source_code : str , dst_file_ext : str ) -> Tuple [DLLWrapper , str , str ]:
3196+ def load (cls , source_code : str , dst_file_ext : str ) -> tuple [DLLWrapper , str , str ]:
31983197 """
31993198 Compiles source code and loads the generated .so file.
32003199 Returns a tuple of DLLWrapper, hash_key, source_code_path
0 commit comments