From cdb2c4ac2f460cd8fcdd5febc3693310961b8259 Mon Sep 17 00:00:00 2001 From: zlsh80826 Date: Fri, 25 Sep 2020 10:34:58 +0800 Subject: [PATCH] replace hard core name to tensorrt engine input --- .../tensorrt/convert/emb_eltwise_layernorm.cc | 12 ++++++++---- .../tensorrt/convert/multihead_matmul_op.cc | 6 ++++-- paddle/fluid/inference/tensorrt/convert/slice_op.cc | 4 +++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc b/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc index 17b0edc065a..651dbe8e0d0 100644 --- a/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc +++ b/paddle/fluid/inference/tensorrt/convert/emb_eltwise_layernorm.cc @@ -114,13 +114,17 @@ class EmbEltwiseLayerNormOpConverter : public OpConverter { std::vector plugin_inputs; plugin_inputs.emplace_back(engine_->GetITensor( - "eval_placeholder_0")); // word_embedding, eval_placeholder_0 + engine_->network()->getInput(0)->getName())); // word_embedding, + // eval_placeholder_0 plugin_inputs.emplace_back(engine_->GetITensor( - "eval_placeholder_1")); // sent_embedding, eval_placeholder_1 + engine_->network()->getInput(1)->getName())); // sent_embedding, + // eval_placeholder_1 plugin_inputs.emplace_back(engine_->GetITensor( - "eval_placeholder_2")); // cu_seqlens, eval_placeholder_2 + engine_->network()->getInput(2)->getName())); // cu_seqlens, + // eval_placeholder_2 plugin_inputs.emplace_back(engine_->GetITensor( - "eval_placeholder_3")); // max_seqlen, eval_placeholder_3 + engine_->network()->getInput(3)->getName())); // max_seqlen, + // eval_placeholder_3 auto creator = GetPluginRegistry()->getPluginCreator( "CustomEmbLayerNormPluginDynamic", "2"); diff --git a/paddle/fluid/inference/tensorrt/convert/multihead_matmul_op.cc b/paddle/fluid/inference/tensorrt/convert/multihead_matmul_op.cc index 4bce6eac8c3..edc01c6ce34 100644 --- a/paddle/fluid/inference/tensorrt/convert/multihead_matmul_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/multihead_matmul_op.cc @@ -149,9 +149,11 @@ class MultiheadMatMulOpConverter : public OpConverter { plugin_inputs.emplace_back(fc_layer->getOutput(0)); plugin_inputs.emplace_back(mask_tensor); plugin_inputs.emplace_back(engine_->GetITensor( - "eval_placeholder_2")); // cu_seqlens, eval_placeholder_2 + engine_->network()->getInput(2)->getName())); // cu_seqlens, + // eval_placeholder_2 plugin_inputs.emplace_back(engine_->GetITensor( - "eval_placeholder_3")); // max_seqlen, eval_placeholder_3 + engine_->network()->getInput(3)->getName())); // max_seqlen, + // eval_placeholder_3 auto plugin_layer = engine_->network()->addPluginV2( plugin_inputs.data(), plugin_inputs.size(), *plugin); layer = plugin_layer; diff --git a/paddle/fluid/inference/tensorrt/convert/slice_op.cc b/paddle/fluid/inference/tensorrt/convert/slice_op.cc index 316ac8e353f..f8d2998378b 100644 --- a/paddle/fluid/inference/tensorrt/convert/slice_op.cc +++ b/paddle/fluid/inference/tensorrt/convert/slice_op.cc @@ -50,7 +50,9 @@ class SliceOpConverter : public OpConverter { std::vector plugin_inputs; // plugin_inputs.emplace_back(trans_layer->getOutput(0)); plugin_inputs.emplace_back(input); - plugin_inputs.emplace_back(engine_->GetITensor("eval_placeholder_2")); + plugin_inputs.emplace_back(engine_->GetITensor( + engine_->network()->getInput(2)->getName())); // cu_seqlens, + // eval_placeholder_2 // bool ban_fp16 = engine_->disable_trt_plugin_fp16(); plugin::SpecialSlicePluginDynamic* plugin = -- GitLab