未验证 提交 9a04540c 编写于 作者: Z zhoutianzi666 提交者: GitHub

[Paddle-TRT] fix conv2d/int64 (#45023)

* fix_conv2d_2_3

* commit

* fix_conv2d_2_3

* fix_conv2d_2_3

* fix_conv2d_2_3
上级 cbab0184
...@@ -354,6 +354,22 @@ bool OpTeller::Tell(const framework::ir::Node* node, ...@@ -354,6 +354,22 @@ bool OpTeller::Tell(const framework::ir::Node* node,
} }
} }
#endif #endif
// In fact, this should include all conv, not only conv2d
if (op_type == "conv2d") {
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* filter_var_desc = block->FindVar(desc.Input("Filter")[0]);
if (!filter_var_desc->Persistable()) {
VLOG(3) << "Trt not support filter is a intermediate tensor in "
"conv2d op.";
return false;
}
}
} }
if (op_type == "deformable_conv") { if (op_type == "deformable_conv") {
...@@ -912,6 +928,19 @@ bool OpTeller::Tell(const framework::ir::Node* node, ...@@ -912,6 +928,19 @@ bool OpTeller::Tell(const framework::ir::Node* node,
return false; 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_desc = block->FindVar(desc.Input("X")[0]);
auto dtype = x_var_desc->GetDataType();
// At present, forbid int64_t into trt.
if (dtype == 3) {
return false;
}
} }
if (op_type == "unsqueeze2") { if (op_type == "unsqueeze2") {
...@@ -931,6 +960,19 @@ bool OpTeller::Tell(const framework::ir::Node* node, ...@@ -931,6 +960,19 @@ bool OpTeller::Tell(const framework::ir::Node* node,
return false; 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_desc = block->FindVar(desc.Input("X")[0]);
auto dtype = x_var_desc->GetDataType();
// At present, forbid int64_t into trt.
if (dtype == 3) {
return false;
}
} }
if (op_type == "batch_norm") { if (op_type == "batch_norm") {
...@@ -1073,6 +1115,11 @@ bool OpTeller::Tell(const framework::ir::Node* node, ...@@ -1073,6 +1115,11 @@ bool OpTeller::Tell(const framework::ir::Node* node,
auto x_var_name = desc.Input("X")[0]; auto x_var_name = desc.Input("X")[0];
auto* x_var_desc = block->FindVar(x_var_name); auto* x_var_desc = block->FindVar(x_var_name);
const auto x_shape = x_var_desc->GetShape(); const auto x_shape = x_var_desc->GetShape();
auto dtype = x_var_desc->GetDataType();
// At present, only support float32 or float16 into trt.
if (!(dtype == 5 || dtype == 4)) {
return false;
}
if (!with_dynamic_shape && x_shape.size() == 1) { if (!with_dynamic_shape && x_shape.size() == 1) {
VLOG(3) << "Scale op does not support 1-dimensional input in tensorrt"; VLOG(3) << "Scale op does not support 1-dimensional input in tensorrt";
return false; return false;
...@@ -1163,6 +1210,20 @@ bool OpTeller::Tell(const framework::ir::Node* node, ...@@ -1163,6 +1210,20 @@ bool OpTeller::Tell(const framework::ir::Node* node,
return false; 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_desc = block->FindVar(desc.Input("Input")[0]);
auto dtype = x_var_desc->GetDataType();
// At present, forbid int64_t into trt.
if (dtype == 3) {
return false;
}
} }
if (op_type == "elementwise_add" || op_type == "elementwise_mul" || if (op_type == "elementwise_add" || op_type == "elementwise_mul" ||
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册