Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
d80330fe
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
d80330fe
编写于
11月 26, 2022
作者:
G
gem5
提交者:
GitHub
11月 26, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add reciprocal trt converter (#48230)
上级
ab6a3dad
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
11 deletion
+20
-11
paddle/fluid/inference/tensorrt/convert/unary_op.cc
paddle/fluid/inference/tensorrt/convert/unary_op.cc
+6
-0
paddle/fluid/inference/tensorrt/op_teller.cc
paddle/fluid/inference/tensorrt/op_teller.cc
+13
-11
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_unary.py
...id/tests/unittests/ir/inference/test_trt_convert_unary.py
+1
-0
未找到文件。
paddle/fluid/inference/tensorrt/convert/unary_op.cc
浏览文件 @
d80330fe
...
...
@@ -81,6 +81,7 @@ const std::unordered_map<std::string, nvinfer1::UnaryOperation>
{
"atanh"
,
nvinfer1
::
UnaryOperation
::
kATANH
},
{
"ceil"
,
nvinfer1
::
UnaryOperation
::
kCEIL
},
{
"floor"
,
nvinfer1
::
UnaryOperation
::
kFLOOR
},
{
"reciprocal"
,
nvinfer1
::
UnaryOperation
::
kRECIP
},
#if IS_TRT_VERSION_GE(7000)
{
"erf"
,
nvinfer1
::
UnaryOperation
::
kERF
},
#endif
...
...
@@ -152,6 +153,10 @@ class FloorOpConverter : public UnaryOpConverter {
public:
FloorOpConverter
()
{
op_type_
=
"floor"
;
}
};
class
ReciprocalOpConverter
:
public
UnaryOpConverter
{
public:
ReciprocalOpConverter
()
{
op_type_
=
"reciprocal"
;
}
};
#if IS_TRT_VERSION_GE(7000)
class
ErfOpConverter
:
public
UnaryOpConverter
{
public:
...
...
@@ -179,6 +184,7 @@ REGISTER_TRT_OP_CONVERTER(asinh, AsinhOpConverter);
REGISTER_TRT_OP_CONVERTER
(
atanh
,
AtanhOpConverter
);
REGISTER_TRT_OP_CONVERTER
(
ceil
,
CeilOpConverter
);
REGISTER_TRT_OP_CONVERTER
(
floor
,
FloorOpConverter
);
REGISTER_TRT_OP_CONVERTER
(
reciprocal
,
ReciprocalOpConverter
);
#if IS_TRT_VERSION_GE(7000)
REGISTER_TRT_OP_CONVERTER
(
erf
,
ErfOpConverter
);
#endif
paddle/fluid/inference/tensorrt/op_teller.cc
浏览文件 @
d80330fe
...
...
@@ -79,17 +79,17 @@ struct SimpleOpTypeSetTeller : public Teller {
desc
.
HasAttr
(
"skip_quant"
))
return
false
;
std
::
unordered_set
<
std
::
string
>
act_op_list
=
{
"relu"
,
"relu6"
,
"sigmoid"
,
"elu"
,
"selu"
,
"softsign"
,
"softplus"
,
"stanh"
,
"thresholded_relu"
,
"exp"
,
"log"
,
"sqrt"
,
"abs"
,
"sin"
,
"cos"
,
"tan"
,
"tanh"
,
"sinh"
,
"cosh"
,
"asin"
,
"acos"
,
"atan"
,
"asinh"
,
"atanh"
,
"ceil"
,
"floor"
,
"erf"
,
"
silu"
,
"celu"
,
"tanh_shrink
"
,
"logsigmoid"
};
"relu"
,
"relu6"
,
"sigmoid"
,
"elu"
,
"selu"
,
"softsign"
,
"softplus"
,
"stanh"
,
"thresholded_relu"
,
"exp"
,
"log"
,
"sqrt"
,
"abs"
,
"sin"
,
"cos"
,
"tan"
,
"tanh"
,
"sinh"
,
"cosh"
,
"asin"
,
"acos"
,
"atan"
,
"asinh"
,
"atanh"
,
"ceil"
,
"floor"
,
"erf"
,
"
reciprocal"
,
"silu"
,
"celu
"
,
"
tanh_shrink"
,
"
logsigmoid"
};
if
(
act_op_list
.
find
(
op_type
)
!=
act_op_list
.
end
())
{
auto
*
block
=
desc
.
Block
();
if
(
block
==
nullptr
)
{
...
...
@@ -2301,6 +2301,7 @@ struct SimpleOpTypeSetTeller : public Teller {
"atanh"
,
"ceil"
,
"floor"
,
"reciprocal"
,
"erf"
,
"softmax"
,
"sigmoid"
,
...
...
@@ -2428,6 +2429,7 @@ struct SimpleOpTypeSetTeller : public Teller {
"atanh"
,
"ceil"
,
"floor"
,
"reciprocal"
,
"erf"
,
"softmax"
,
"sigmoid"
,
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_unary.py
浏览文件 @
d80330fe
...
...
@@ -59,6 +59,7 @@ class TrtConvertActivationTest(TrtLayerAutoScanTest):
"atanh"
,
"ceil"
,
"floor"
,
"reciprocal"
,
]:
self
.
dims
=
dims
dics
=
[{}]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录