Skip to content

Commit 2b332c8

Browse files
committed
filter unsupported inputs for elementwise op in op teller
1 parent e6a19ae commit 2b332c8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

paddle/fluid/inference/tensorrt/op_teller.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,21 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
10111011
VLOG(3) << "Now trt may not support two 1d tensor elementwise op.";
10121012
return false;
10131013
}
1014+
if (op_type == "elementwise_add" || op_type == "elementwise_mul") {
1015+
if (x_var_desc->Persistable()) {
1016+
VLOG(3) << "Input X is a parameter which is not supported for "
1017+
"elementwise_add/elementwise_mul in tensorrt, swap x and "
1018+
"y will work";
1019+
return false;
1020+
}
1021+
}
1022+
if (op_type == "elementwise_sub" || op_type == "elementwise_div") {
1023+
if (x_var_desc->Persistable() || y_var_desc->Persistable()) {
1024+
VLOG(3) << "Input X or Input Y is a parameter which is not supported "
1025+
"for elementwise_sub/elementwise_div in tensorrt";
1026+
return false;
1027+
}
1028+
}
10141029
}
10151030

10161031
if (op_type == "stack") {

0 commit comments

Comments
 (0)