diff --git a/paddle/fluid/inference/tensorrt/op_teller.cc b/paddle/fluid/inference/tensorrt/op_teller.cc index ba130ec2380d4ef2c81fbdc0c5f0d0823b0f653c..34d6881560a4a28719106b856b372f8afbed33ed 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();