未验证 提交 2a94b817 编写于 作者: Z Zhang Jun 提交者: GitHub

[inference][trt]Remove unused code from teller.cc (#53758)

* remove unused code
上级 00c21abc
......@@ -416,12 +416,6 @@ struct SimpleOpTypeSetTeller : public Teller {
auto x_var_name = desc.Input("X")[0];
auto* x_var_desc = block->FindVar(x_var_name);
const auto x_shape = x_var_desc->GetShape();
if (!with_dynamic_shape && (x_shape.size() == 1 || x_shape.size() == 0)) {
VLOG(3) << op_type
<< " op does not support input's dim is 1 or 0 in tensorrt "
"with static shape.";
return false;
}
if (with_dynamic_shape && (x_shape.size() == 1 || x_shape.size() == 0)) {
int axis = desc.HasAttr("axis")
......@@ -1198,11 +1192,6 @@ struct SimpleOpTypeSetTeller : public Teller {
dtype == framework::proto::VarType::FP16)) {
return false;
}
if (x_shape.size() == 1 || x_shape.size() == 0) {
VLOG(3) << "Scale op does not support 0 or 1-dimensional input in "
"tensorrt";
return false;
}
} else {
// At present, only support float32 or float16 or int32 or int64 into
// trt.
......@@ -1527,13 +1516,7 @@ struct SimpleOpTypeSetTeller : public Teller {
return false;
}
auto* x_var_desc = block->FindVar(desc.Input("X")[0]);
const auto x_shape = x_var_desc->GetShape();
if (!with_dynamic_shape && (x_shape.size() == 1 || x_shape.size() == 0)) {
VLOG(3) << op_type
<< " op does not support input's dim is 1 or 0 in tensorrt "
"static shape mode.";
return false;
}
// the same as `elementwise_pow`.
if (x_var_desc->GetDataType() ==
paddle::framework::proto::VarType_Type::VarType_Type_INT32) {
......@@ -1572,26 +1555,6 @@ struct SimpleOpTypeSetTeller : public Teller {
}
}
if (op_type == "sum") {
auto* block = desc.Block();
if (block == nullptr) {
VLOG(3) << "The block desc is nullptr, we can't continue to analyze. "
"Developers need to check whether block_desc is passed in "
"the pass.";
return false;
}
auto x_var_name = desc.Input("X")[0];
auto* x_var = block->FindVar(x_var_name);
const auto x_shape = x_var->GetShape();
if (!with_dynamic_shape && (x_shape.size() == 0 || x_shape.size() == 1)) {
VLOG(3) << op_type
<< " op does not support input's dim is 0 or 1 in tensorrt "
"with static shape.";
return false;
}
return true;
}
if (op_type == "shape" && !with_dynamic_shape) {
return false;
}
......@@ -1657,24 +1620,6 @@ struct SimpleOpTypeSetTeller : public Teller {
if (PADDLE_GET_CONST(bool, desc.GetAttr("approximate"))) return false;
}
#endif
auto* block = desc.Block();
if (block == nullptr) {
VLOG(3) << "The block desc is nullptr, we can't continue to analyze. "
"Developers need to check whether block_desc is passed in "
"the pass.";
return false;
}
auto x_var_name = desc.Input("X")[0];
auto* x_var_desc = block->FindVar(x_var_name);
const auto x_shape = x_var_desc->GetShape();
if (!with_dynamic_shape && (x_shape.size() == 1 || x_shape.size() == 0)) {
VLOG(3) << op_type
<< "gelu op does not support input's dim is 1 or 0 in tensorrt "
"static shape mode.";
return false;
}
}
if (op_type == "layer_norm") {
......@@ -1864,16 +1809,6 @@ struct SimpleOpTypeSetTeller : public Teller {
"static shape mode.";
return false;
}
auto x_var_name = desc.Input("X")[0];
auto* x_var = block->FindVar(x_var_name);
const auto x_shape = x_var->GetShape();
if (!with_dynamic_shape && (x_shape.size() == 1 || x_shape.size() == 0)) {
VLOG(3) << op_type
<< " op does not support input's dim is 1 or 0 in tensorrt "
"with static shape.";
return false;
}
}
if (op_type == "mish") {
......@@ -1889,24 +1824,6 @@ struct SimpleOpTypeSetTeller : public Teller {
<< desc.Output("Out").size() << ".";
return false;
}
auto* block = desc.Block();
if (block == nullptr) {
VLOG(3) << "The block desc is nullptr, we can't continue to analyze. "
"Developers need to check whether block_desc is passed in "
"the pass.";
return false;
}
auto x_var_name = desc.Input("X")[0];
auto* x_var_desc = block->FindVar(x_var_name);
const auto x_shape = x_var_desc->GetShape();
if ((!with_dynamic_shape && x_shape.size() == 1) || x_shape.size() == 0) {
VLOG(3) << op_type
<< "mish op does not support input's dim is 1 in tensorrt "
"static shape mode or 0.";
return false;
}
}
if (op_type == "roi_align") {
......@@ -2194,25 +2111,6 @@ struct SimpleOpTypeSetTeller : public Teller {
}
}
if (op_type == "square") {
auto* block = desc.Block();
if (block == nullptr) {
VLOG(3) << "The block desc is nullptr, we can't continue to analyze. "
"Developers need to check whether block_desc is passed in "
"the pass.";
return false;
}
auto x_var_name = desc.Input("X")[0];
auto* x_var = block->FindVar(x_var_name);
const auto x_shape = x_var->GetShape();
if (!with_dynamic_shape && x_shape.size() == 0) {
VLOG(3) << op_type
<< " op does not support input's dim is 0 in tensorrt "
"with static shape.";
return false;
}
}
if (op_type == "clip") {
// Paddle-TRT does not support the input tensors: Min and Max
auto clip_inputs = desc.Inputs();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册