We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1c7d94e commit 418824eCopy full SHA for 418824e
exir/program/_program.py
@@ -1497,3 +1497,17 @@ def write_to_file(self, open_file: io.BufferedIOBase) -> None:
1497
reducing the peak memory usage.
1498
"""
1499
self._pte_data.write_to_file(open_file)
1500
+
1501
+ def save(self, path: str) -> None:
1502
+ """
1503
+ Saves the serialized ExecuTorch binary to the file at `path`.
1504
1505
+ if path[-4:] != ".pte":
1506
+ logging.error(f"Path {path} does not end with .pte")
1507
+ raise ValueError(f"Path {path} does not end with .pte")
1508
+ try:
1509
+ with open(path, "wb") as file:
1510
+ self.write_to_file(file)
1511
+ logging.info(f"Saved exported program to {path}")
1512
+ except Exception as e:
1513
+ logging.error(f"Error while saving to {path}: {e}")
0 commit comments