Skip to content

Add subgraph fuse support and anakin engine#16018

Merged
NHZlX merged 4 commits intoPaddlePaddle:feature/anakin-enginefrom
NHZlX:anakin_subgraph_dev
Mar 6, 2019
Merged

Add subgraph fuse support and anakin engine#16018
NHZlX merged 4 commits intoPaddlePaddle:feature/anakin-enginefrom
NHZlX:anakin_subgraph_dev

Conversation

@NHZlX
Copy link
Contributor

@NHZlX NHZlX commented Mar 1, 2019

No description provided.


if (pass_name == "anakin_subgraph_pass") {
pass->Set("program",
new framework::ProgramDesc *(&argument->main_program()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the main_program is the original program,
it is also stored in the graph passed to Graph.

// Add new block for TensorRTEngineOP
const framework::BlockDesc &main_block =
program_desc->Block(framework::kRootBlockIndex);
// const framework::BlockDesc& main_block = program_desc->Block(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this line

@@ -0,0 +1,152 @@
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LIcense format is wrong

// "identity_scale_op_clean_pass", //
/*
"conv_affine_channel_fuse_pass", //
"conv_eltwiseadd_affine_channel_fuse_pass", //
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add an API to switch these latter

.ConvertBlock(block_desc, param_names_, scope, engine);
engine->Freeze();
engine->Optimize();
engine->Save("anakin.saved");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to remove this?

auto &t =
inference::analysis::GetFromScope<framework::LoDTensor>(scope, x);
auto t_shape = framework::vectorize2int(t.dims());
std::cout << "!!!!!!!!" << t_shape.size() << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove these, or use VLOG

weight_tensor.Resize(y_t->dims());
TensorCopySync((*y_t), platform::CPUPlace(), &weight_tensor);
auto *weight_data = weight_tensor.data<float>();
PADDLE_ENFORCE(w_m * w_k == weight_tensor.numel());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weight_tensor.numel()返回类型是int64_t

Copy link
Contributor

@fc500110 fc500110 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@NHZlX NHZlX merged commit 77d8a42 into PaddlePaddle:feature/anakin-engine Mar 6, 2019
NHZlX added a commit to NHZlX/Paddle that referenced this pull request Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants