From d42a1dc3187c24a7f81f759ef62e7690ca62a180 Mon Sep 17 00:00:00 2001 From: zhoutianzi666 <39978853+zhoutianzi666@users.noreply.github.com> Date: Fri, 21 Oct 2022 21:05:28 +0800 Subject: [PATCH] [Paddle-TRT] Fix conv2d (#47034) * forbid Conv2D into Paddle-TensoRT when weight is not persistable. --- paddle/fluid/inference/tensorrt/op_teller.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/paddle/fluid/inference/tensorrt/op_teller.cc b/paddle/fluid/inference/tensorrt/op_teller.cc index 6e8661180b..f472a972a9 100644 --- a/paddle/fluid/inference/tensorrt/op_teller.cc +++ b/paddle/fluid/inference/tensorrt/op_teller.cc @@ -280,6 +280,15 @@ struct SimpleOpTypeSetTeller : public Teller { } } #endif + auto* block = desc.Block(); + if (block) { + auto* filter_var_desc = block->FindVar(desc.Input("Filter")[0]); + if (!filter_var_desc->Persistable()) { + VLOG(3) << "Trt not support filter is a intermediate tensor in " + "conv2d op."; + return false; + } + } } if (op_type == "deformable_conv") { -- GitLab