From 3c26824b7549d6c8032854a89a388965e47a7696 Mon Sep 17 00:00:00 2001 From: wenbin Date: Wed, 7 Jul 2021 05:36:12 +0000 Subject: [PATCH 1/3] correct conditions of gather in opteller --- paddle/fluid/inference/tensorrt/op_teller.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/inference/tensorrt/op_teller.cc b/paddle/fluid/inference/tensorrt/op_teller.cc index c21ef8840de129..3c1338ece51bef 100644 --- a/paddle/fluid/inference/tensorrt/op_teller.cc +++ b/paddle/fluid/inference/tensorrt/op_teller.cc @@ -314,8 +314,14 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8, } if (op_type == "gather") { + if (!with_dynamic_shape) return false; + + auto inputs = desc.InputArgumentNames(); + for (auto& input : inputs) { + if (input == "Axis" && desc.Input("Axis").size() > 0) return false; + } // current not support axis from input, use default 0 - if (!with_dynamic_shape || desc.Input("Axis").size() > 0) return false; + if (desc.GetAttrIfExists("axis")) return false; } if (op_type == "gather_nd") { From cc93a67b5ebabf24e61332034e3051ced58ade73 Mon Sep 17 00:00:00 2001 From: wenbin Date: Wed, 7 Jul 2021 10:39:17 +0000 Subject: [PATCH 2/3] test=develop --- paddle/fluid/inference/tensorrt/op_teller.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/paddle/fluid/inference/tensorrt/op_teller.cc b/paddle/fluid/inference/tensorrt/op_teller.cc index 3c1338ece51bef..228358444c3c44 100644 --- a/paddle/fluid/inference/tensorrt/op_teller.cc +++ b/paddle/fluid/inference/tensorrt/op_teller.cc @@ -320,6 +320,7 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8, for (auto& input : inputs) { if (input == "Axis" && desc.Input("Axis").size() > 0) return false; } + // current not support axis from input, use default 0 if (desc.GetAttrIfExists("axis")) return false; } From f291c8c541fe40b26c235e5a2e6bd11625e610d6 Mon Sep 17 00:00:00 2001 From: wenbin Date: Wed, 7 Jul 2021 11:01:53 +0000 Subject: [PATCH 3/3] test=allcase --- paddle/fluid/inference/tensorrt/op_teller.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/paddle/fluid/inference/tensorrt/op_teller.cc b/paddle/fluid/inference/tensorrt/op_teller.cc index 228358444c3c44..4fb8188bd7fa0b 100644 --- a/paddle/fluid/inference/tensorrt/op_teller.cc +++ b/paddle/fluid/inference/tensorrt/op_teller.cc @@ -315,12 +315,10 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8, if (op_type == "gather") { if (!with_dynamic_shape) return false; - auto inputs = desc.InputArgumentNames(); for (auto& input : inputs) { if (input == "Axis" && desc.Input("Axis").size() > 0) return false; } - // current not support axis from input, use default 0 if (desc.GetAttrIfExists("axis")) return false; }