From 5d7e5e35abfd84e37dced743b82c956db393c9b4 Mon Sep 17 00:00:00 2001 From: Wilber Date: Fri, 20 Nov 2020 10:57:36 +0800 Subject: [PATCH] [Release/1.8] Fix run ssd model with trt error. (#28705) * update. * fix trt error in ssd model. --- paddle/fluid/inference/tensorrt/op_teller.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/inference/tensorrt/op_teller.cc b/paddle/fluid/inference/tensorrt/op_teller.cc index ba130ec2380..34d6881560a 100644 --- a/paddle/fluid/inference/tensorrt/op_teller.cc +++ b/paddle/fluid/inference/tensorrt/op_teller.cc @@ -107,7 +107,14 @@ bool OpTeller::Tell(const std::string& op_type, const framework::OpDesc& desc, op_type == "depthwise_conv2d" || op_type == "conv2d_transpose") { std::vector paddings = boost::get>(desc.GetAttr("paddings")); - if (paddings.size() > 2) return false; + + std::string padding_algorithm = "EXPLICIT"; + if (desc.HasAttr("padding_algorithm")) + padding_algorithm = + boost::get(desc.GetAttr("padding_algorithm")); + if (paddings.size() > 2 || + (padding_algorithm == "SAME" && op_type != "pool2d")) + return false; } if (op_type == "matmul") { auto* block = desc.Block(); -- GitLab