MCPcopy Create free account
hub / github.com/pytorch/executorch / save

Method save

exir/program/_program.py:2030–2042  ·  view source on GitHub ↗

Saves the serialized ExecuTorch binary to the file at `path`.

(self, path: str)

Source from the content-addressed store, hash-verified

2028 cord.write_to_file(f)
2029
2030 def save(self, path: str) -> None:
2031 """
2032 Saves the serialized ExecuTorch binary to the file at `path`.
2033 """
2034 if path[-4:] != ".pte":
2035 logging.error(f"Path {path} does not end with .pte")
2036 raise ValueError(f"Path {path} does not end with .pte")
2037 try:
2038 with open(path, "wb") as file:
2039 self.write_to_file(file)
2040 logging.info(f"Saved exported program to {path}")
2041 except Exception as e:
2042 logging.error(f"Error while saving to {path}: {e}")

Callers 15

check_serdeMethod · 0.45
test_delegate_xnnpackMethod · 0.45
test_save_failsMethod · 0.45
serialize_torch_artifactFunction · 0.45
save_vocabularyMethod · 0.45
_save_pretrainedMethod · 0.45
infer_modelFunction · 0.45
mainFunction · 0.45
get_modelFunction · 0.45
save_imageFunction · 0.45
save_image_tensorFunction · 0.45

Calls 2

write_to_fileMethod · 0.95
infoMethod · 0.80

Tested by 3

check_serdeMethod · 0.36
test_delegate_xnnpackMethod · 0.36
test_save_failsMethod · 0.36