Files
pytorch/torch/csrc/jit/runtime/static/impl.h
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

29 lines
715 B
C++

#pragma once
#include <ATen/core/interned_strings.h>
#include <ATen/core/ivalue.h>
#include <torch/csrc/jit/api/module.h>
#include <torch/csrc/jit/ir/ir.h>
#include <torch/csrc/jit/passes/constant_propagation.h>
#include <torch/csrc/jit/passes/inliner.h>
namespace torch {
namespace jit {
class TORCH_API StaticRuntime {
public:
StaticRuntime(std::shared_ptr<torch::jit::Graph> g) : graph_(std::move(g)) {}
StaticRuntime(
const torch::jit::Module& m,
std::shared_ptr<torch::jit::Graph> g);
std::vector<at::Tensor> run(const std::vector<at::Tensor>& inps) const;
private:
std::shared_ptr<torch::jit::Graph> graph_;
torch::jit::Module module_;
};
} // namespace jit
} // namespace torch