Skip to content

Commit 378690b

Browse files
committed
refactor(//core/lowering): Update lowering for PyTorch 1.6.0
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent fe06d09 commit 378690b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Diff for: core/lowering/lowering.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "torch/csrc/jit/passes/lower_graph.h"
88
#include "torch/csrc/jit/passes/lower_tuples.h"
99
#include "torch/csrc/jit/passes/peephole.h"
10-
#include "torch/csrc/jit/passes/quantization.h"
1110

1211
#include "core/util/prelude.h"
1312
#include "core/lowering/lowering.h"
@@ -50,8 +49,7 @@ torch::jit::Module LowerModule(const torch::jit::script::Module& mod) {
5049
return mod_;
5150
}
5251

53-
std::pair<std::shared_ptr<torch::jit::Graph>, std::vector<at::Tensor>> Lower(const torch::jit::script::Module& mod,
54-
std::string method_name) {
52+
std::pair<std::shared_ptr<torch::jit::Graph>, std::vector<at::Tensor>> Lower(const torch::jit::script::Module& mod, std::string method_name) {
5553
auto lowered_mod = LowerModule(mod);
5654
auto g = lowered_mod.get_method(method_name).graph();
5755
LOG_GRAPH(*g);
@@ -62,9 +60,14 @@ std::pair<std::shared_ptr<torch::jit::Graph>, std::vector<at::Tensor>> Lower(con
6260
lowering::LowerGraph(g);
6361
//=[torch::jit::FoldConvBatchNorm2d(lowered_mod);
6462
LOG_GRAPH("LibTorch Lowering");
65-
auto graph_and_parameters = torch::jit::LowerGraph(*g, lowered_mod._ivalue());
63+
auto graph_and_ivalues = torch::jit::LowerGraph(*g, lowered_mod._ivalue());
6664
// Is this necessary?
6765
lowering::LowerBlock(g->block());
66+
std::pair<std::shared_ptr<torch::jit::Graph>, std::vector<at::Tensor>> graph_and_parameters;
67+
for (auto i : graph_and_ivalues.second) {
68+
graph_and_parameters.second.push_back(i.toTensor());
69+
}
70+
graph_and_parameters.first = graph_and_ivalues.first;
6871
return graph_and_parameters;
6972
}
7073

0 commit comments

Comments
 (0)