Export API Reference (original) (raw)

For detailed information on how APIs evolve and the deprecation process, please refer to the ExecuTorch API Life Cycle and Deprecation Policy.

executorch.exir.to_edge(*args, **kwargs)[source]#

executorch.exir.to_edge_transform_and_lower(*args, **kwargs)[source]#

class executorch.exir.EdgeProgramManager(edge_programs, constant_methods=None, compile_config=None, core_aten_ops_exception_list=None, preserve_ops=None)[source]#

Package of one or more ExportedPrograms in Edge dialect. Designed to simplify lowering to ExecuTorch. See: https://pytorch.org/executorch/main/ir-exir

Allows easy applications of transforms across a collection of exported programs including the delegation of subgraphs.

Manages the second link in the lowering chain of ATen -> Edge -> ExecuTorch.

property config_methods#

Returns the set of config methods in this EdgeProgramManager.

exported_program(method_name='forward')[source]#

Returns the ExportedProgram specified by ‘method_name’.

property methods#

Returns the set of methods in this EdgeProgramManager.

class executorch.exir.ExecutorchProgramManager(execution_programs, config_methods=None, backend_config=None, named_data=None)[source]#

Package of one or more ExportedPrograms in Execution dialect. Designed to simplify lowering to ExecuTorch. See: https://pytorch.org/executorch/main/ir-exir

When the ExecutorchProgramManager is constructed the ExportedPrograms in execution dialect are used to form the executorch binary (in a process called emission) and then serialized to a buffer.

Manages the final link in the lowering chain of ATen -> Edge -> ExecuTorch.

property buffer#

Returns the serialized ExecuTorch binary as a byte string.

Note that the call to buffer may allocate a very large amount of contiguous memory, depending on the model size. If writing to a file, use write_to_file which won’t incur additional copies.

property config_methods#

Returns the set of config methods in this ExecutorchProgramManager.

dump_executorch_program(verbose=False, out=None)[source]#

Prints the ExecuTorch binary in a human readable format.

Parameters:

exported_program(method_name='forward')[source]#

Returns the ExportedProgram specified by ‘method_name’.

property methods#

Returns the set of methods in this ExecutorchProgramManager.

executorch.exir.backend.backend_api.to_backend(args)[source]#

executorch.exir.backend.backend_api.to_backend(backend_id, edge_program, compile_specs)

executorch.exir.backend.backend_api.to_backend(edge_program, partitioner_instance)

executorch.exir.backend.backend_api.to_backend(method_edge_program_partitioners)

A generic function the dispatch happens on the type of the first argument. There are currently to overloaded to_backend function:

Note: Python is dynamically-typed language and therefore cannot have proper method overloading as that requires the language to be able to discriminate between types at compile-time. @to_backend.register will attach the function to to_backend() base on the type of the first argument (type annotation is required). However, it can’t take multiple types as arguments.

def to_backend( backend_id: str, edge_graph_module: ExportedProgram, compile_specs: List[CompileSpec], ) -> LoweredBackendModule:

def to_backend( edge_program: ExportedProgram, partitioner: Partitioner, ) -> ExportedProgram:

class executorch.exir.backend.backend_api.LoweredBackendModule(edge_program, backend_id, processed_bytes, compile_specs, named_data_store_output=None)[source]#

A subclass of nn.Module that is generated for modules containing delegated functions. This is can be created by calling to_backend.

property backend_id#

Returns the backends name.

buffer(extract_delegate_segments=False, segment_alignment=128, constant_tensor_alignment=None, delegate_alignment=None, memory_planning=None)[source]#

Returns a buffer containing the serialized ExecuTorch binary.

property compile_specs#

Returns a list of backend-specific objects with static metadata to configure the “compilation” process.

property original_module#

Returns the original EXIR module

property processed_bytes#

Returns the delegate blob created from backend.preprocess