Skip to content

Commit b6f52e2

Browse files
Update on "[ExecuTorch][#10447] Extend PyBundledModule with extension.BundledModule"
#10447 # Context This issue is a step of #9638. In #9638, we want to have `extension.Module` as the single source of implementation in `pybindings`, which means that `pybindings.PyModule` should use `extension.Module` rather than its own `pybindings.Module`. # Proposal Now that we have `extension.BundledModule` ready, we want to test it out by having our existing `PyBundledModule` to extend it, and let `verify_result_with_bundled_expected_output` to use it, so that we can test out the whole thing with https://github.com/pytorch/executorch/blob/fb45e19055a92d2a91a4d4b7008e135232cbb14b/devtools/bundled_program/test/test_end2end.py Differential Revision: [D73564127](https://our.internmc.facebook.com/intern/diff/D73564127/) [ghstack-poisoned]
2 parents 2ee4772 + d2fb052 commit b6f52e2

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

extension/module/test/resources/gen_bundled_program.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from executorch.exir import to_edge_transform_and_lower
1111
from torch.export import export, export_for_training
1212

13+
1314
# Step 1: ExecuTorch Program Export
1415
class SampleModel(torch.nn.Module):
1516
"""An example model with multi-methods. Each method has multiple input and single output"""
@@ -27,6 +28,7 @@ def forward(self, x: torch.Tensor, q: torch.Tensor) -> torch.Tensor:
2728
torch.add(y, q, out=y)
2829
return y
2930

31+
3032
def main() -> None:
3133
"""Sample code to generate bundled program and save it to file. It is the same as in https://pytorch.org/executorch/0.6/bundled-io.html#emit-example"""
3234
# Inference method name of SampleModel we want to bundle testcases to.
@@ -46,7 +48,6 @@ def main() -> None:
4648
capture_input,
4749
)
4850

49-
5051
# Emit the traced method into ET Program.
5152
et_program = to_edge_transform_and_lower(method_graph).to_executorch()
5253

extension/pybindings/pybindings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ using ::executorch::ET_RUNTIME_NAMESPACE::Kernel;
9595
using ::executorch::ET_RUNTIME_NAMESPACE::Method;
9696
using ::executorch::ET_RUNTIME_NAMESPACE::Program;
9797
using ::executorch::extension::BufferDataLoader;
98+
using ::executorch::extension::BundledModule;
9899
using ::executorch::extension::MallocMemoryAllocator;
99100
using ::executorch::extension::MmapDataLoader;
100-
using ::executorch::extension::BundledModule;
101101
using ::executorch::runtime::ArrayRef;
102102
using ::executorch::runtime::DataLoader;
103103
using ::executorch::runtime::Error;

0 commit comments

Comments
 (0)