目录

导出到 ExecuTorch API 参考

有关 API 如何发展和弃用过程的详细信息,请参阅 ExecuTorch API 生命周期和弃用策略

executorch.exir 中。to_edgeself*args**kwargs[来源]
executorch.exir 中。to_edge_transform_and_lowerself*args**kwargs[来源]
executorch.exir 中。EdgeProgramManageredge_programsconstant_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 中的配置方法集。

exported_programmethod_name='forward'[来源]

返回由 'method_name' 指定的 ExportedProgram。

属性方法

返回此 EdgeProgramManager 中的方法集。

executorch.exir 中。ExecutorchProgramManagerexecution_programsconfig_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_programverbose=Falseout=None[来源]

以人类可读的格式打印 ExecuTorch 二进制文件。

参数
  • verbosebool) – 如果为 False,则以压缩格式打印二进制文件。 如果为 True,则打印二进制 1-1 以及架构中的规范。

  • 如果为 None,则打印到 stdout。 如果为非 None,则将字符串写入该 stream 对象。可以是

    文件对象、StringIO 对象或任何其他 TextIO 子类。

exported_programmethod_name='forward'[来源]

返回由 'method_name' 指定的 ExportedProgram。

属性方法

返回此 ExecutorchProgramManager 中的方法集。

executorch.exir.backend.backend_api。to_backendargs[来源]
executorch.exir.backend.backend_api。to_backendbackend_idedge_programcompile_specs)
executorch.exir.backend.backend_api。to_backendedge_programpartitioner_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 类LoweredBackendModuleedge_programbackend_idprocessed_bytescompile_specs[来源]

nn.为包含 委托函数。这可以通过调用 to_backend 来创建。

属性backend_id

返回后端名称。

bufferextract_delegate_segments=Falsesegment_alignment=128constant_tensor_alignment=delegate_alignment=无memory_planning=[来源]

返回包含序列化 ExecuTorch 二进制文件的缓冲区。

物业 compile_specs

返回具有静态元数据的后端特定对象列表,以配置 “compilation” 过程。

属性 original_module

返回原始 EXIR 模块

属性 processed_bytes

返回从 backend.preprocess 创建的委托 blob

文档

访问 PyTorch 的全面开发人员文档

查看文档

教程

获取面向初学者和高级开发人员的深入教程

查看教程

资源

查找开发资源并解答您的问题

查看资源