Saves the serialized ExecuTorch binary to the file at `path`.
(self, path: str)
| 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}") |