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

Method get_exported_program

export/export.py:476–503  ·  view source on GitHub ↗

Get the ExportedProgram for a specific method after torch export. Args: method_name: Name of the method to get exported program for, defaults to "forward" Returns: The ExportedProgram for the specified method Raises: RuntimeErro

(self, method_name: str = "forward")

Source from the content-addressed store, hash-verified

474 return self._stage_to_artifacts
475
476 def get_exported_program(self, method_name: str = "forward") -> ExportedProgram:
477 """
478 Get the ExportedProgram for a specific method after torch export.
479
480 Args:
481 method_name: Name of the method to get exported program for, defaults to "forward"
482
483 Returns:
484 The ExportedProgram for the specified method
485
486 Raises:
487 RuntimeError: If torch export stage has not been run
488 KeyError: If the method name is not found in exported programs
489 """
490 artifact = self._stage_to_artifacts.get(StageType.TORCH_EXPORT)
491 if artifact is None or artifact.data is None:
492 raise RuntimeError(
493 "Exported program is not available. Run Torch Export Stage first."
494 )
495
496 exported_programs = artifact.data
497 if method_name not in exported_programs:
498 raise KeyError(
499 f"Method name '{method_name}' not found in exported programs. "
500 f"Available methods: {list(exported_programs.keys())}"
501 )
502
503 return exported_programs[method_name]
504
505 def get_edge_program_manager(self) -> "EdgeProgramManager":
506 """

Calls 2

keysMethod · 0.80
getMethod · 0.45