Skip to content

Commit 35f9e28

Browse files
committed
[pybind] Add pybind API reference docs
Summary: As titled Test Plan: Reviewers: Subscribers: Tasks: Tags:
1 parent aa852cc commit 35f9e28

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Runtime Pybind API Reference
2+
----------------------------------
3+
Pybind APIs can load a serialized .pte file (see `Export to ExecuTorch Tutorial <tutorials/export-to-executorch-tutorial.html>`__ for how to get .pte file from a PyTorch `nn.Module`) and execute it using `torch.Tensor` as inputs, in a Python environment. The result also comes back as `torch.Tensor` so it can be used as a quick way to validate the correctness of the program.
4+
5+
For detailed information on how APIs evolve and the deprecation process, please refer to the `ExecuTorch API Life Cycle and Deprecation Policy <api-life-cycle.html>`__.
6+
7+
.. automodule:: executorch.runtime
8+
.. autoclass:: Runtime
9+
:members: get, load_program
10+
11+
.. autoclass:: OperatorRegistry
12+
:members: operator_names
13+
14+
.. autoclass:: Program
15+
:members: method_names, load_method
16+
17+
.. autoclass:: Method
18+
:members: execute, metadata

runtime/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ def __init__(self, module: ExecuTorchModule, data: Optional[bytes]) -> None:
107107

108108
@property
109109
def method_names(self) -> Set[str]:
110+
"""
111+
Returns method names of the `Program` as a set of strings.
112+
"""
110113
return set(self._methods.keys())
111114

112115
def load_method(self, name: str) -> Optional[Method]:
@@ -130,7 +133,9 @@ def __init__(self, legacy_module: ModuleType) -> None:
130133

131134
@property
132135
def operator_names(self) -> Set[str]:
133-
"""The names of all registered operators."""
136+
"""
137+
Returns the names of all registered operators as a set of strings.
138+
"""
134139
return set(self._legacy_module._get_operator_names())
135140

136141

0 commit comments

Comments
 (0)