(
self,
exir_exported_program: ExirExportedProgram,
emit_stacktrace: bool,
extract_delegate_segments: bool,
segment_alignment: int,
constant_tensor_alignment: Optional[int] = None,
delegate_alignment: Optional[int] = None,
)
| 569 | @compatibility(is_backward_compatible=False) |
| 570 | class ExecutorchProgram: |
| 571 | def __init__( |
| 572 | self, |
| 573 | exir_exported_program: ExirExportedProgram, |
| 574 | emit_stacktrace: bool, |
| 575 | extract_delegate_segments: bool, |
| 576 | segment_alignment: int, |
| 577 | constant_tensor_alignment: Optional[int] = None, |
| 578 | delegate_alignment: Optional[int] = None, |
| 579 | ) -> None: |
| 580 | if not exir_exported_program.after_to_edge_passes: |
| 581 | raise RuntimeError( |
| 582 | "Need to call prog.to_edge prior to constructing ExecutorchProgram." |
| 583 | ) |
| 584 | self.exported_program = exir_exported_program.exported_program |
| 585 | self._pte_data: Optional[Cord] = None |
| 586 | self._tensor_data: Optional[Dict[str, Cord]] = None |
| 587 | self._buffer: Optional[bytes] = None |
| 588 | self._emitter_output: Optional[EmitterOutput] = None |
| 589 | self._emit_stacktrace: bool = emit_stacktrace |
| 590 | self._extract_delegate_segments: bool = extract_delegate_segments |
| 591 | self._segment_alignment: int = segment_alignment |
| 592 | self._constant_tensor_alignment: Optional[int] = constant_tensor_alignment |
| 593 | self._delegate_alignment: Optional[int] = delegate_alignment |
| 594 | from executorch.extension.flat_tensor.serialize.serialize import ( |
| 595 | FlatTensorConfig, |
| 596 | FlatTensorSerializer, |
| 597 | ) |
| 598 | |
| 599 | self._data_serializer: DataSerializer = FlatTensorSerializer( |
| 600 | FlatTensorConfig(self._segment_alignment) |
| 601 | ) |
| 602 | |
| 603 | def _get_emitter_output(self) -> EmitterOutput: |
| 604 | if self._emitter_output is None: |
no test coverage detected