Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/mul converter #10841

Merged
merged 25 commits into from
May 29, 2018
Merged

Conversation

Superjomn
Copy link
Contributor

@Superjomn Superjomn commented May 22, 2018

Add mul-op with a UT framework to test TensorRT op converter.

@Superjomn Superjomn force-pushed the feature/mul_converter branch 4 times, most recently from 5b30915 to 4ce465c Compare May 27, 2018 07:11
for (const auto& output : op_desc_->OutputArgumentNames()) {
std::vector<float> fluid_out;
std::vector<float> trt_out(200);
engine_->GetOutputInCPU(output, &trt_out[0], 200 * sizeof(float));
Copy link
Contributor

Choose a reason for hiding this comment

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

这里为什么是200呢?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

200 是 memory space,没有特殊意义

Copy link
Contributor

Choose a reason for hiding this comment

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

可以加个注释说明下为什么取200,会不会以后不够大。

// Compare two output
ASSERT_FALSE(fluid_out.empty());
for (size_t i = 0; i < fluid_out.size(); i++) {
EXPECT_LT(std::abs(fluid_out[i] - trt_out[i]), 0.001);
Copy link
Contributor

Choose a reason for hiding this comment

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

0.001有点太大了。e-6?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

准备在下个pr改过去

framework::OpDesc op_desc(op, nullptr, nullptr);
// Declare inputs
auto* input1 = engine_->GetITensor(op_desc.Input("X")[0]);
auto* input2 = engine_->GetITensor(op_desc.Input("Y")[0]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Y这个值是weight,是存在scope里的,不是从GetITensor取的。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里 X,Y 的确是在 TensorRT 空间的,具体怎么把叫 X, Y 的 Tensor 从 Scope 拷贝到 TensorRT 里,是外层的其他逻辑去控制,ut里是一个framework去做这个

Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

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

LGTM! 一些comment在下一个PR进行修改。

@Superjomn Superjomn merged commit f5fc9c3 into PaddlePaddle:develop May 29, 2018
@Superjomn Superjomn deleted the feature/mul_converter branch May 29, 2018 05:06
@luotao1 luotao1 mentioned this pull request Jun 12, 2018
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.

None yet

2 participants