MCPcopy Create free account
hub / github.com/pytorch/pytorch / load

Method load

torch/_inductor/codecache.py:2255–2269  ·  view source on GitHub ↗

Compiles source code and loads the generated .so file. Returns a tuple of DLLWrapper, hash_key, source_code_path

(cls, source_code, dst_file_ext)

Source from the content-addressed store, hash-verified

2253
2254 @classmethod
2255 def load(cls, source_code, dst_file_ext) -> Tuple[DLLWrapper, str, str]:
2256 """
2257 Compiles source code and loads the generated .so file.
2258 Returns a tuple of DLLWrapper, hash_key, source_code_path
2259 """
2260
2261 if dst_file_ext != "so":
2262 raise RuntimeError(
2263 f"Only support loading a .so file for now. "
2264 f"Requested file extension: {dst_file_ext}. Source code: {source_code}"
2265 )
2266 dst_file_path, hash_key, source_code_path = cls.compile(
2267 source_code, dst_file_ext
2268 )
2269 return (DLLWrapper(dst_file_path), hash_key, source_code_path)
2270
2271
2272def caching_device_properties():

Callers

nothing calls this directly

Calls 2

DLLWrapperClass · 0.85
compileMethod · 0.45

Tested by

no test coverage detected