Skip to content

refine EngineIOConverter, and use io_convert in test_trt_activation_op#10495

Merged
luotao1 merged 7 commits intoPaddlePaddle:developfrom
luotao1:refine_relu_test
May 15, 2018
Merged

refine EngineIOConverter, and use io_convert in test_trt_activation_op#10495
luotao1 merged 7 commits intoPaddlePaddle:developfrom
luotao1:refine_relu_test

Conversation

@luotao1
Copy link
Contributor

@luotao1 luotao1 commented May 8, 2018

  1. change EngineInputConverter to EngineIOConverter, which has two function: ConvertInput(LoDTensor->ITensor) and ConvertOutput(ITensor -> LoDTensor)
  2. improve the unit-test test_io_converter.cc
  3. use EngineIOConverter in unit-test test_activation_op.cc
  4. remove duplicated cudaMemcpyAsync in SetInputFromCPU
@luotao1 luotao1 added the 预测 原名Inference,包含Capi预测问题等 label May 8, 2018
@luotao1 luotao1 requested a review from Superjomn May 8, 2018 11:21
cudaMemcpyHostToHost, *stream_));

PADDLE_ENFORCE_EQ(0, cudaMemcpyAsync(out, in.data<float>(), size,
cudaMemcpyHostToHost, *stream_));
Copy link
Contributor

Choose a reason for hiding this comment

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

not DeiveceToDevice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

* so in the default case just need to copy the data.
*/
class EngineInputConverter {
class EngineIOConverter {
Copy link
Contributor

Choose a reason for hiding this comment

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

Add comments about how to register a convter from fluid to TRT or from TRT to fluid.

For example, a converter for a special Op called x that from fluid to TRT will register as Fluid(x)->TRT.

Or a special Layer in TRT called y that convert output from TRT to fluid will register as TRT(y)->Fluid.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

add some comments at first.

Copy link
Contributor

@Superjomn Superjomn left a comment

Choose a reason for hiding this comment

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

LGTM

namespace tensorrt {

void Compare(float input, float expect) {
void Compare(const std::string op_type, float input, float expect) {
Copy link
Contributor

Choose a reason for hiding this comment

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

const string&

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will correct in next PR.

@luotao1 luotao1 merged commit 6cbe597 into PaddlePaddle:develop May 15, 2018
@luotao1 luotao1 deleted the refine_relu_test branch May 15, 2018 05:53
@luotao1 luotao1 mentioned this pull request May 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

预测 原名Inference,包含Capi预测问题等

2 participants