Skip to content

Commit 623ec28

Browse files
committed
fix bugs
1 parent 66cff92 commit 623ec28

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

paddle/fluid/inference/analysis/ir_passes/lite_subgraph_pass.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ void OrganizeProgram(Node *merged_node,
168168
subgraph.size());
169169

170170
std::unordered_set<Node *> io_var_nodes = GetRelatedIOVarNodes(subgraph);
171+
for (const auto* node: io_var_nodes) {
172+
LOG(INFO) << "IO Variable Name: " << node->Name();
173+
}
171174

172175
std::vector<framework::OpDesc*> subgraph_ops;
173176
for (auto *op_node : subgraph) {
@@ -178,6 +181,9 @@ void OrganizeProgram(Node *merged_node,
178181
ModifyEngineProgram(merged_node, host_program, engine_program, host_sub_block,
179182
io_var_nodes, subgraph_ops);
180183
*repetitive_params = ExtractParameters(io_var_nodes);
184+
for (const auto& param: *repetitive_params) {
185+
LOG(INFO) << "Repetitive param: " << param;
186+
}
181187

182188
host_program->Flush();
183189
engine_program->Flush();
@@ -199,6 +205,7 @@ void LiteSubgraphPass::SetUpEngine(framework::ProgramDesc* program,
199205
std::ostringstream os;
200206
platform::CPUDeviceContext ctx;
201207
for (const auto& param: params) {
208+
LOG(INFO) << "Serialize param: " << param;
202209
PADDLE_ENFORCE_NOT_NULL(scope->FindVar(param), "Block should already have a '%s' variable",
203210
param);
204211
auto* tensor = scope->FindVar(param)->GetMutable<framework::LoDTensor>();
@@ -262,6 +269,8 @@ void LiteSubgraphPass::ApplyImpl(
262269
auto teller = [&lite_ops_filter](const Node *node) {
263270
if (!node->IsOp() || !node->Op())
264271
return false;
272+
else if (node->Op()->Type() == "feed" || node->Op()->Type() == "fetch")
273+
return false;
265274
else if (std::find(lite_ops_filter.begin(), lite_ops_filter.end(),
266275
node->Op()->Type()) != lite_ops_filter.end())
267276
return false;

paddle/fluid/inference/lite/test_predictor.cc

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include <ios>
1616
#include <fstream>
17-
#include <gtest/gtest.h>
1817

1918
#include "lite/api/paddle_use_kernels.h"
2019
#include "lite/api/paddle_use_ops.h"
@@ -23,14 +22,9 @@
2322
#include "paddle/fluid/platform/enforce.h"
2423
#include "paddle/fluid/inference/api/paddle_inference_api.h"
2524

26-
namespace paddle {
27-
namespace lite {
28-
29-
using paddle::AnalysisConfig;
30-
31-
TEST(AnalysisPredictor, Lite) {
32-
33-
AnalysisConfig config;
25+
int main() {
26+
LOG(INFO) << "Hello World!";
27+
paddle::AnalysisConfig config;
3428
config.SetModel("/shixiaowei02/Paddle_lite/xingzhaolong/leaky_relu_model");
3529
config.SwitchUseFeedFetchOps(false);
3630
config.EnableUseGpu(10, 1);
@@ -39,8 +33,5 @@ TEST(AnalysisPredictor, Lite) {
3933

4034
auto predictor = CreatePaddlePredictor(config);
4135
PADDLE_ENFORCE_NOT_NULL(predictor.get());
36+
return 0;
4237
}
43-
44-
45-
} // namespace lite
46-
} // namespace paddle

0 commit comments

Comments
 (0)