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

Function gen_etrecord

examples/devtools/scripts/gen_sample_etrecord.py:32–47  ·  view source on GitHub ↗
(model: torch.nn.Module, inputs: Any, output_path=None)

Source from the content-addressed store, hash-verified

30
31
32def gen_etrecord(model: torch.nn.Module, inputs: Any, output_path=None):
33 f = model
34 aten_dialect: ExportedProgram = export(f, inputs, strict=True)
35 edge_program: EdgeProgramManager = to_edge(
36 aten_dialect, compile_config=EdgeCompileConfig(_check_ir_validity=True)
37 )
38 edge_program_copy = copy.deepcopy(edge_program)
39 et_program: ExecutorchProgramManager = edge_program_copy.to_executorch()
40 generate_etrecord(
41 (DEFAULT_OUTPUT_PATH if not output_path else output_path),
42 edge_dialect_program=edge_program,
43 executorch_program=et_program,
44 extra_recorded_export_modules={
45 "aten_dialect_output": aten_dialect,
46 },
47 )
48
49
50def main() -> None:

Callers 1

mainFunction · 0.85

Calls 5

exportFunction · 0.90
to_edgeFunction · 0.90
EdgeCompileConfigClass · 0.90
generate_etrecordFunction · 0.90
to_executorchMethod · 0.45

Tested by

no test coverage detected