导出到 ExecuTorch API 参考¶
有关 API 如何发展和弃用过程的详细信息,请参阅 ExecuTorch API 生命周期和弃用策略。
- 类 executorch.exir 中。EdgeProgramManager(edge_programs, constant_methods=无, compile_config=无, ops_set_to_not_decompose=无)[来源]¶
Edge 方言中的一个或多个 ExportedPrograms 的包。旨在简化 降低到 ExecuTorch。另请: https://pytorch.org/executorch/stable/ir-exir.html
允许在导出的程序集合中轻松应用转换 包括子图的委派。
管理 ATen -> Edge -> ExecuTorch 的下降链中的第二个链接。
- 属性 config_methods¶
返回此 EdgeProgramManager 中的配置方法集。
- 属性方法¶
返回此 EdgeProgramManager 中的方法集。
- 类 executorch.exir 中。ExecutorchProgramManager(execution_programs, config_methods=无, backend_config=无)[来源]¶
执行方言中的一个或多个 ExportedPrograms 的包。旨在简化 降低到 ExecuTorch。另请: https://pytorch.org/executorch/stable/ir-exir.html
当 ExecutorchProgramManager 被构造时,ExportedPrograms in execution dialect 用于形成 executorch 二进制文件(在称为 emission的过程中),然后序列化 添加到缓冲区。
管理 ATen -> Edge -> ExecuTorch 的下降链中的最后一个环节。
- 属性缓冲区¶
将序列化的 ExecuTorch 二进制文件作为字节字符串返回。
请注意,对 buffer 的调用可能会分配非常大量的 连续内存,具体取决于模型大小。如果写入文件, 使用不会产生额外副本的 write_to_file。
- 属性 config_methods¶
返回此 ExecutorchProgramManager 中的配置方法集。
- dump_executorch_program(verbose=False, out=None)[来源]¶
以人类可读的格式打印 ExecuTorch 二进制文件。
- 参数
verbose (bool) – 如果为 False,则以压缩格式打印二进制文件。 如果为 True,则打印二进制 1-1 以及架构中的规范。
出 –
如果为 None,则打印到 stdout。 如果为非 None,则将字符串写入该 stream 对象。可以是
文件对象、StringIO 对象或任何其他 TextIO 子类。
- 属性方法¶
返回此 ExecutorchProgramManager 中的方法集。
- executorch.exir.backend.backend_api。to_backend(args)[来源]¶
- executorch.exir.backend.backend_api。to_backend(backend_id, edge_program, compile_specs)
- executorch.exir.backend.backend_api。to_backend(edge_program, partitioner_instance)
一个泛型函数,dispatch 发生在第一个参数的类型上。目前有 to 重载的 to_backend 函数:
注意: Python 是动态类型的语言,因此不能有适当的方法重载,因为这需要语言 能够在编译时区分类型。@to_backend.register to_backend将根据第一个 参数(需要类型注释)。但是,它不能将多个类型作为参数。
def to_backend( backend_id: str, edge_graph_module: ExportedProgram, compile_specs: List[CompileSpec], ) -> LoweredBackendModule: def to_backend( graph_module: torch.fx.GraphModule, partitioner: Type[TPartitioner], ) -> torch.fx.GraphModule
- executorch.exir.backend.backend_api 类。LoweredBackendModule(edge_program, backend_id, processed_bytes, compile_specs)[来源]¶
nn.为包含 委托函数。这可以通过调用 to_backend 来创建。
- 属性backend_id¶
返回后端名称。
- buffer(extract_delegate_segments=False, segment_alignment=128, constant_tensor_alignment=无, delegate_alignment=无, memory_planning=无)[来源]¶
返回包含序列化 ExecuTorch 二进制文件的缓冲区。
- 物业 compile_specs¶
返回具有静态元数据的后端特定对象列表,以配置 “compilation” 过程。
- 属性 original_module¶
返回原始 EXIR 模块
- 属性 processed_bytes¶
返回从 backend.preprocess 创建的委托 blob