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

Function save_pte_program

backends/nxp/tests/utils.py:17–34  ·  view source on GitHub ↗
(
    prog: ExecutorchProgramManager, model_name: str, output_dir: str = ""
)

Source from the content-addressed store, hash-verified

15
16
17def save_pte_program(
18 prog: ExecutorchProgramManager, model_name: str, output_dir: str = ""
19) -> str:
20 if model_name.endswith(".pte"):
21 filename = model_name
22 visualize_file_name = f"{model_name}.json"
23 else:
24 filename = os.path.join(output_dir, f"{model_name}.pte")
25 visualize_file_name = os.path.join(output_dir, f"{model_name}.json")
26 try:
27 with open(filename, "wb") as file:
28 prog.write_to_file(file)
29 logging.info(f"Saved exported program to {filename}")
30 except Exception as e:
31 logging.error(f"Error while saving to {filename}: {e}")
32
33 visualize_with_clusters(prog.exported_program(), visualize_file_name, False)
34 return filename

Callers 4

export_and_generate_pteFunction · 0.90
mainFunction · 0.90

Calls 4

visualize_with_clustersFunction · 0.90
infoMethod · 0.80
write_to_fileMethod · 0.45
exported_programMethod · 0.45