From 0699afb112355f7e0a08b05030bb7fe613554d81 Mon Sep 17 00:00:00 2001 From: xiaoxiaohehe001 <49090790+xiaoxiaohehe001@users.noreply.github.com> Date: Fri, 13 Jan 2023 17:40:36 +0800 Subject: [PATCH] fix_arg_release24 (#49771) --- paddle/fluid/inference/tensorrt/op_teller.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/inference/tensorrt/op_teller.cc b/paddle/fluid/inference/tensorrt/op_teller.cc index 9c1939a064a..ecc089e134a 100644 --- a/paddle/fluid/inference/tensorrt/op_teller.cc +++ b/paddle/fluid/inference/tensorrt/op_teller.cc @@ -639,8 +639,12 @@ struct SimpleOpTypeSetTeller : public Teller { int axis = desc.HasAttr("axis") ? PADDLE_GET_CONST(int64_t, desc.GetAttr("axis")) : -1; - bool flatten = PADDLE_GET_CONST(bool, desc.GetAttr("flatten")); - int dtype = PADDLE_GET_CONST(int, desc.GetAttr("dtype")); + bool flatten = desc.HasAttr("flatten") + ? PADDLE_GET_CONST(bool, desc.GetAttr("flatten")) + : false; + int dtype = desc.HasAttr("dtype") + ? PADDLE_GET_CONST(int, desc.GetAttr("dtype")) + : 3; if (axis == 0 || flatten || dtype != 2) return false; } -- GitLab