Files
pytorch/torch/csrc/jit/runtime/static/init.cpp
Bram Wasti ada8404f2d [jit] Scaffold a static runtime (#42753)
Summary:
The premise of this approach is that a small subset of neural networks are well represented by a data flow graph.  The README contains more information.

The name is subject to change, but I thought it was a cute reference to fire.

suo let me know if you'd prefer this in a different spot.  Since it lowers a JIT'd module directly I assumed the JIT folder would be appropriate.  There is no exposed Python interface yet (but is mocked up in `test_accelerant.py`)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/42753

Reviewed By: zou3519

Differential Revision: D23043771

Pulled By: bwasti

fbshipit-source-id: 5353731e3aae31c08b5b49820815da98113eb551
2020-08-12 13:05:27 -07:00

25 lines
704 B
C++

#include <torch/csrc/jit/runtime/static/impl.h>
#include <torch/csrc/jit/runtime/static/init.h>
namespace torch {
namespace jit {
void initStaticRuntimeBindings(PyObject* module) {
auto m = py::handle(module).cast<py::module>();
py::class_<StaticRuntime>(m, "StaticRuntime").def("run", &StaticRuntime::run);
m.def(
"_jit_to_static_runtime",
[](const std::shared_ptr<torch::jit::Graph>& g) {
return StaticRuntime(g);
})
.def(
"_jit_to_static_runtime",
[](const torch::jit::Module& m,
const std::shared_ptr<torch::jit::Graph>& g) {
return StaticRuntime(m, g);
});
}
} // namespace jit
} // namespace torch