Description
🚀 The feature, motivation and pitch
Today our python apis in executorch.runtime are implemented off of extension/pybindings which only offers a module api.
We would like to migrate to having the lower level ET api exposed to python directly and then writing the module api in python. The first step to this is adding pybindings for Method.
https://github.com/pytorch/executorch/blob/main/extension/pybindings/pybindings.cpp#L1020 -> Here is where the current pybind11 code is.
I think for a first pass we can skip exposing DataLoader to python.
Program should hopefully be straightforward. The only tricky thing is the Program class does not assume ownership of the data loader so the pybindings under the hood will need to guarantee the lifespan by coupling the dataload to the program.
Method is a little trickier because of similar lifespan issues but this time with the memory allocators. Again for a first pass at this I think we just start with tightly coupling them.
program.h/cpp and method.h/cpp are defined in https://github.com/pytorch/executorch/tree/main/runtime/executor
The pybindings test code is a little annoying because we build a couple libs against it. In general though all you have to do is add a new function to https://github.com/pytorch/executorch/blob/main/extension/pybindings/test/make_test.py and then call it from the bottom of the file.
Alternatives
No response
Additional context
No response
RFC (Optional)
No response
Metadata
Metadata
Assignees
Type
Projects
Status
Status