Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Shixiaowei02 committed Oct 17, 2019
1 parent 66cff92 commit 623ec28
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ void OrganizeProgram(Node *merged_node,
subgraph.size());

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

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

host_program->Flush();
engine_program->Flush();
Expand All @@ -199,6 +205,7 @@ void LiteSubgraphPass::SetUpEngine(framework::ProgramDesc* program,
std::ostringstream os;
platform::CPUDeviceContext ctx;
for (const auto& param: params) {
LOG(INFO) << "Serialize param: " << param;
PADDLE_ENFORCE_NOT_NULL(scope->FindVar(param), "Block should already have a '%s' variable",
param);
auto* tensor = scope->FindVar(param)->GetMutable<framework::LoDTensor>();
Expand Down Expand Up @@ -262,6 +269,8 @@ void LiteSubgraphPass::ApplyImpl(
auto teller = [&lite_ops_filter](const Node *node) {
if (!node->IsOp() || !node->Op())
return false;
else if (node->Op()->Type() == "feed" || node->Op()->Type() == "fetch")
return false;
else if (std::find(lite_ops_filter.begin(), lite_ops_filter.end(),
node->Op()->Type()) != lite_ops_filter.end())
return false;
Expand Down
17 changes: 4 additions & 13 deletions paddle/fluid/inference/lite/test_predictor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

#include <ios>
#include <fstream>
#include <gtest/gtest.h>

#include "lite/api/paddle_use_kernels.h"
#include "lite/api/paddle_use_ops.h"
Expand All @@ -23,14 +22,9 @@
#include "paddle/fluid/platform/enforce.h"
#include "paddle/fluid/inference/api/paddle_inference_api.h"

namespace paddle {
namespace lite {

using paddle::AnalysisConfig;

TEST(AnalysisPredictor, Lite) {

AnalysisConfig config;
int main() {
LOG(INFO) << "Hello World!";
paddle::AnalysisConfig config;
config.SetModel("/shixiaowei02/Paddle_lite/xingzhaolong/leaky_relu_model");
config.SwitchUseFeedFetchOps(false);
config.EnableUseGpu(10, 1);
Expand All @@ -39,8 +33,5 @@ TEST(AnalysisPredictor, Lite) {

auto predictor = CreatePaddlePredictor(config);
PADDLE_ENFORCE_NOT_NULL(predictor.get());
return 0;
}


} // namespace lite
} // namespace paddle

0 comments on commit 623ec28

Please sign in to comment.