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

Method __init__

exir/program/_program.py:1859–1916  ·  view source on GitHub ↗

End users should not call this constructor directly. Instead, they should use :func:'to_executorch' to construct an ExecutorchProgramManager. Constructs an ExecutorchProgramManager from a set of exported programs in execution dialect. Args: exec

(
        self,
        execution_programs: Dict[str, ExportedProgram],
        config_methods: Optional[Dict[str, Any]] = None,
        backend_config: Optional[ExecutorchBackendConfig] = None,
        named_data: Optional[NamedDataStoreOutput] = None,
    )

Source from the content-addressed store, hash-verified

1857 """
1858
1859 def __init__(
1860 self,
1861 execution_programs: Dict[str, ExportedProgram],
1862 config_methods: Optional[Dict[str, Any]] = None,
1863 backend_config: Optional[ExecutorchBackendConfig] = None,
1864 named_data: Optional[NamedDataStoreOutput] = None,
1865 ):
1866 """
1867 End users should not call this constructor directly. Instead, they should use
1868 :func:'to_executorch' to construct an ExecutorchProgramManager.
1869
1870 Constructs an ExecutorchProgramManager from a set of exported programs in
1871 execution dialect.
1872
1873 Args:
1874 execution_programs: A dictionary of method name to the corresponding
1875 ExportedProgram.
1876
1877 config_methods: A dictionary of method name to the config value returned
1878 by that method in eager mode.
1879
1880 backend_config: An optional argument used to provide greater control over
1881 the emission and serialization.
1882 """
1883 # Set up methods
1884 self._execution_programs: Dict[str, ExportedProgram] = execution_programs
1885 self._config_methods: Optional[Dict[str, Any]] = config_methods
1886
1887 # Named data from EdgeProgramManager
1888 self._named_data: Optional[NamedDataStoreOutput] = named_data
1889
1890 backend_config = backend_config or ExecutorchBackendConfig()
1891
1892 # Emit methods
1893 self._emitter_output: EmitterOutput = emit_program(
1894 self._execution_programs,
1895 backend_config.emit_stacktrace,
1896 self._config_methods,
1897 backend_config.emit_mutable_buffer_names,
1898 )
1899
1900 # Serialize emitter output, ready to be written to a file.
1901 from executorch.extension.flat_tensor.serialize.serialize import (
1902 FlatTensorConfig,
1903 FlatTensorSerializer,
1904 )
1905
1906 self._data_serializer = FlatTensorSerializer(
1907 FlatTensorConfig(segment_alignment=backend_config.segment_alignment)
1908 )
1909 self._pte_data, self._tensor_data = serialize_for_executorch(
1910 self._emitter_output,
1911 backend_config,
1912 self._data_serializer,
1913 self._named_data,
1914 )
1915 self._buffer: Optional[bytes] = None
1916 self._etrecord = None

Callers

nothing calls this directly

Calls 5

emit_programFunction · 0.90
FlatTensorConfigClass · 0.90
serialize_for_executorchFunction · 0.90

Tested by

no test coverage detected