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 e013e53 commit c83cc42Copy full SHA for c83cc42
exir/program/_program.py
@@ -1519,3 +1519,17 @@ def write_to_file(self, open_file: io.BufferedIOBase) -> None:
1519
reducing the peak memory usage.
1520
"""
1521
self._pte_data.write_to_file(open_file)
1522
+
1523
+ def save(self, path: str) -> None:
1524
+ """
1525
+ Saves the serialized ExecuTorch binary to the file at `path`.
1526
1527
+ if path[-4:] != ".pte":
1528
+ logging.error(f"Path {path} does not end with .pte")
1529
+ raise ValueError(f"Path {path} does not end with .pte")
1530
+ try:
1531
+ with open(path, "wb") as file:
1532
+ self.write_to_file(file)
1533
+ logging.info(f"Saved exported program to {path}")
1534
+ except Exception as e:
1535
+ logging.error(f"Error while saving to {path}: {e}")
0 commit comments