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

Method write

torch/_inductor/codecache.py:2211–2223  ·  view source on GitHub ↗

Writes source code into a file with dst_file_ext as the file extension. Returns the hash key of source code, and the path to the file.

(cls, source_code, dst_file_ext)

Source from the content-addressed store, hash-verified

2209
2210 @classmethod
2211 def write(cls, source_code, dst_file_ext) -> Tuple[str, str]:
2212 """
2213 Writes source code into a file with dst_file_ext as the file extension.
2214 Returns the hash key of source code, and the path to the file.
2215 """
2216
2217 cuda_command = repr(
2218 cuda_compile_command(["dummy_input"], "dummy_output", dst_file_ext)
2219 )
2220 key, input_path = write(
2221 source_code, cls._SOURCE_CODE_SUFFIX, extra=cuda_command
2222 )
2223 return key, input_path
2224
2225 @classmethod
2226 def compile(cls, source_code, dst_file_ext) -> Tuple[str, str, str]:

Callers

nothing calls this directly

Calls 2

cuda_compile_commandFunction · 0.85
writeFunction · 0.70

Tested by

no test coverage detected