Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
06bd348d
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 2 年 前同步成功
通知
2325
Star
20933
Fork
5424
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
06bd348d
编写于
10月 20, 2021
作者:
W
Wilber
提交者:
GitHub
10月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update for trt convert ut. (#36549)
上级
8ca5206b
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
88 addition
and
12 deletion
+88
-12
paddle/fluid/inference/tensorrt/op_teller.cc
paddle/fluid/inference/tensorrt/op_teller.cc
+8
-0
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_activation.py
...sts/unittests/ir/inference/test_trt_convert_activation.py
+1
-0
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_affine_channel.py
...unittests/ir/inference/test_trt_convert_affine_channel.py
+1
-0
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_elementwise.py
...ts/unittests/ir/inference/test_trt_convert_elementwise.py
+1
-0
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_emb_eltwise_layernorm.py
...ts/ir/inference/test_trt_convert_emb_eltwise_layernorm.py
+1
-0
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_flatten.py
.../tests/unittests/ir/inference/test_trt_convert_flatten.py
+53
-12
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_gather.py
...d/tests/unittests/ir/inference/test_trt_convert_gather.py
+1
-0
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_gather_nd.py
...ests/unittests/ir/inference/test_trt_convert_gather_nd.py
+1
-0
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_gelu.py
...uid/tests/unittests/ir/inference/test_trt_convert_gelu.py
+1
-0
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_group_norm.py
...sts/unittests/ir/inference/test_trt_convert_group_norm.py
+1
-0
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_prelu.py
...id/tests/unittests/ir/inference/test_trt_convert_prelu.py
+14
-0
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_reshape.py
.../tests/unittests/ir/inference/test_trt_convert_reshape.py
+1
-0
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_scale.py
...id/tests/unittests/ir/inference/test_trt_convert_scale.py
+1
-0
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_shuffle_channel.py
...nittests/ir/inference/test_trt_convert_shuffle_channel.py
+1
-0
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_swish.py
...id/tests/unittests/ir/inference/test_trt_convert_swish.py
+1
-0
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_transpose.py
...ests/unittests/ir/inference/test_trt_convert_transpose.py
+1
-0
未找到文件。
paddle/fluid/inference/tensorrt/op_teller.cc
浏览文件 @
06bd348d
...
@@ -1104,6 +1104,14 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
...
@@ -1104,6 +1104,14 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
return
false
;
return
false
;
}
}
}
}
#if IS_TRT_VERSION_LT(7000)
if
(
!
with_dynamic_shape
)
{
// TODO(inference): fix trt6 static plugin error.
VLOG
(
3
)
<<
"prelu static plugin in trt6 has bug."
;
return
false
;
}
#endif
}
}
if
(
op_type
==
"mish"
)
{
if
(
op_type
==
"mish"
)
{
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_activation.py
浏览文件 @
06bd348d
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
from
trt_layer_auto_scan_test
import
TrtLayerAutoScanTest
,
SkipReasons
from
trt_layer_auto_scan_test
import
TrtLayerAutoScanTest
,
SkipReasons
from
program_config
import
TensorConfig
,
ProgramConfig
from
program_config
import
TensorConfig
,
ProgramConfig
import
unittest
import
numpy
as
np
import
numpy
as
np
import
paddle.inference
as
paddle_infer
import
paddle.inference
as
paddle_infer
from
functools
import
partial
from
functools
import
partial
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_affine_channel.py
浏览文件 @
06bd348d
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
from
trt_layer_auto_scan_test
import
TrtLayerAutoScanTest
,
SkipReasons
from
trt_layer_auto_scan_test
import
TrtLayerAutoScanTest
,
SkipReasons
from
program_config
import
TensorConfig
,
ProgramConfig
from
program_config
import
TensorConfig
,
ProgramConfig
import
unittest
import
numpy
as
np
import
numpy
as
np
import
paddle.inference
as
paddle_infer
import
paddle.inference
as
paddle_infer
from
functools
import
partial
from
functools
import
partial
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_elementwise.py
浏览文件 @
06bd348d
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
from
trt_layer_auto_scan_test
import
TrtLayerAutoScanTest
,
SkipReasons
from
trt_layer_auto_scan_test
import
TrtLayerAutoScanTest
,
SkipReasons
from
program_config
import
TensorConfig
,
ProgramConfig
from
program_config
import
TensorConfig
,
ProgramConfig
import
unittest
import
numpy
as
np
import
numpy
as
np
import
paddle.inference
as
paddle_infer
import
paddle.inference
as
paddle_infer
from
functools
import
partial
from
functools
import
partial
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_emb_eltwise_layernorm.py
浏览文件 @
06bd348d
...
@@ -18,6 +18,7 @@ import numpy as np
...
@@ -18,6 +18,7 @@ import numpy as np
import
paddle.inference
as
paddle_infer
import
paddle.inference
as
paddle_infer
from
functools
import
partial
from
functools
import
partial
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
import
unittest
class
TrtConvertEmbEltwiseLayernormTest1
(
TrtLayerAutoScanTest
):
class
TrtConvertEmbEltwiseLayernormTest1
(
TrtLayerAutoScanTest
):
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_flatten.py
浏览文件 @
06bd348d
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
from
trt_layer_auto_scan_test
import
TrtLayerAutoScanTest
,
SkipReasons
from
trt_layer_auto_scan_test
import
TrtLayerAutoScanTest
,
SkipReasons
from
program_config
import
TensorConfig
,
ProgramConfig
from
program_config
import
TensorConfig
,
ProgramConfig
import
unittest
import
numpy
as
np
import
numpy
as
np
import
paddle.inference
as
paddle_infer
import
paddle.inference
as
paddle_infer
from
functools
import
partial
from
functools
import
partial
...
@@ -73,10 +74,20 @@ class TrtConvertFlattenTest_dim_2(TrtLayerAutoScanTest):
...
@@ -73,10 +74,20 @@ class TrtConvertFlattenTest_dim_2(TrtLayerAutoScanTest):
self
.
dynamic_shape
.
opt_input_shape
=
{}
self
.
dynamic_shape
.
opt_input_shape
=
{}
def
generate_trt_nodes_num
(
attrs
,
dynamic_shape
):
def
generate_trt_nodes_num
(
attrs
,
dynamic_shape
):
if
attrs
[
0
][
'axis'
]
==
1
:
ver
=
paddle_infer
.
get_trt_compile_version
()
return
1
,
2
if
ver
[
0
]
*
1000
+
ver
[
1
]
*
100
+
ver
[
0
]
*
10
>=
7130
:
if
attrs
[
0
][
'axis'
]
==
1
:
return
1
,
2
else
:
return
0
,
3
else
:
else
:
return
0
,
3
if
dynamic_shape
:
return
0
,
3
if
attrs
[
0
][
'axis'
]
==
1
:
return
1
,
2
else
:
return
0
,
3
attrs
=
[
attrs
=
[
program_config
.
ops
[
i
].
attrs
program_config
.
ops
[
i
].
attrs
...
@@ -157,10 +168,20 @@ class TrtConvertFlattenTest_dim_3(TrtLayerAutoScanTest):
...
@@ -157,10 +168,20 @@ class TrtConvertFlattenTest_dim_3(TrtLayerAutoScanTest):
self
.
dynamic_shape
.
opt_input_shape
=
{}
self
.
dynamic_shape
.
opt_input_shape
=
{}
def
generate_trt_nodes_num
(
attrs
,
dynamic_shape
):
def
generate_trt_nodes_num
(
attrs
,
dynamic_shape
):
if
attrs
[
0
][
'axis'
]
==
1
:
ver
=
paddle_infer
.
get_trt_compile_version
()
return
1
,
2
if
ver
[
0
]
*
1000
+
ver
[
1
]
*
100
+
ver
[
0
]
*
10
>=
7130
:
if
attrs
[
0
][
'axis'
]
==
1
:
return
1
,
2
else
:
return
0
,
3
else
:
else
:
return
0
,
3
if
dynamic_shape
:
return
0
,
3
if
attrs
[
0
][
'axis'
]
==
1
:
return
1
,
2
else
:
return
0
,
3
attrs
=
[
attrs
=
[
program_config
.
ops
[
i
].
attrs
program_config
.
ops
[
i
].
attrs
...
@@ -241,10 +262,20 @@ class TrtConvertFlattenTest_dim_4(TrtLayerAutoScanTest):
...
@@ -241,10 +262,20 @@ class TrtConvertFlattenTest_dim_4(TrtLayerAutoScanTest):
self
.
dynamic_shape
.
opt_input_shape
=
{}
self
.
dynamic_shape
.
opt_input_shape
=
{}
def
generate_trt_nodes_num
(
attrs
,
dynamic_shape
):
def
generate_trt_nodes_num
(
attrs
,
dynamic_shape
):
if
attrs
[
0
][
'axis'
]
==
1
:
ver
=
paddle_infer
.
get_trt_compile_version
()
return
1
,
2
if
ver
[
0
]
*
1000
+
ver
[
1
]
*
100
+
ver
[
0
]
*
10
>=
7130
:
if
attrs
[
0
][
'axis'
]
==
1
:
return
1
,
2
else
:
return
0
,
3
else
:
else
:
return
0
,
3
if
dynamic_shape
:
return
0
,
3
if
attrs
[
0
][
'axis'
]
==
1
:
return
1
,
2
else
:
return
0
,
3
attrs
=
[
attrs
=
[
program_config
.
ops
[
i
].
attrs
program_config
.
ops
[
i
].
attrs
...
@@ -325,10 +356,20 @@ class TrtConvertFlattenTest_dim_5(TrtLayerAutoScanTest):
...
@@ -325,10 +356,20 @@ class TrtConvertFlattenTest_dim_5(TrtLayerAutoScanTest):
self
.
dynamic_shape
.
opt_input_shape
=
{}
self
.
dynamic_shape
.
opt_input_shape
=
{}
def
generate_trt_nodes_num
(
attrs
,
dynamic_shape
):
def
generate_trt_nodes_num
(
attrs
,
dynamic_shape
):
if
attrs
[
0
][
'axis'
]
==
1
:
ver
=
paddle_infer
.
get_trt_compile_version
()
return
1
,
2
if
ver
[
0
]
*
1000
+
ver
[
1
]
*
100
+
ver
[
0
]
*
10
>=
7130
:
if
attrs
[
0
][
'axis'
]
==
1
:
return
1
,
2
else
:
return
0
,
3
else
:
else
:
return
0
,
3
if
dynamic_shape
:
return
0
,
3
if
attrs
[
0
][
'axis'
]
==
1
:
return
1
,
2
else
:
return
0
,
3
attrs
=
[
attrs
=
[
program_config
.
ops
[
i
].
attrs
program_config
.
ops
[
i
].
attrs
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_gather.py
浏览文件 @
06bd348d
...
@@ -19,6 +19,7 @@ import paddle.inference as paddle_infer
...
@@ -19,6 +19,7 @@ import paddle.inference as paddle_infer
from
functools
import
partial
from
functools
import
partial
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
import
logging
import
logging
import
unittest
class
TrtConvertGatherTest
(
TrtLayerAutoScanTest
):
class
TrtConvertGatherTest
(
TrtLayerAutoScanTest
):
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_gather_nd.py
浏览文件 @
06bd348d
...
@@ -18,6 +18,7 @@ import numpy as np
...
@@ -18,6 +18,7 @@ import numpy as np
import
paddle.inference
as
paddle_infer
import
paddle.inference
as
paddle_infer
from
functools
import
partial
from
functools
import
partial
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
import
unittest
class
TrtConvertGatherNdTest_dim_4_1
(
TrtLayerAutoScanTest
):
class
TrtConvertGatherNdTest_dim_4_1
(
TrtLayerAutoScanTest
):
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_gelu.py
浏览文件 @
06bd348d
...
@@ -18,6 +18,7 @@ import numpy as np
...
@@ -18,6 +18,7 @@ import numpy as np
import
paddle.inference
as
paddle_infer
import
paddle.inference
as
paddle_infer
from
functools
import
partial
from
functools
import
partial
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
import
unittest
class
TrtConvertGeluTest
(
TrtLayerAutoScanTest
):
class
TrtConvertGeluTest
(
TrtLayerAutoScanTest
):
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_group_norm.py
浏览文件 @
06bd348d
...
@@ -18,6 +18,7 @@ import numpy as np
...
@@ -18,6 +18,7 @@ import numpy as np
import
paddle.inference
as
paddle_infer
import
paddle.inference
as
paddle_infer
from
functools
import
partial
from
functools
import
partial
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
import
unittest
class
TrtConvertGroupNormTest
(
TrtLayerAutoScanTest
):
class
TrtConvertGroupNormTest
(
TrtLayerAutoScanTest
):
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_prelu.py
浏览文件 @
06bd348d
...
@@ -18,6 +18,7 @@ import numpy as np
...
@@ -18,6 +18,7 @@ import numpy as np
import
paddle.inference
as
paddle_infer
import
paddle.inference
as
paddle_infer
from
functools
import
partial
from
functools
import
partial
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
import
unittest
class
TrtConvertPreluTest
(
TrtLayerAutoScanTest
):
class
TrtConvertPreluTest
(
TrtLayerAutoScanTest
):
...
@@ -186,6 +187,19 @@ class TrtConvertPreluTest(TrtLayerAutoScanTest):
...
@@ -186,6 +187,19 @@ class TrtConvertPreluTest(TrtLayerAutoScanTest):
"Need to repair the case: the output of GPU and tensorrt has diff when the input dimension is 2 in static shape mode."
"Need to repair the case: the output of GPU and tensorrt has diff when the input dimension is 2 in static shape mode."
)
)
ver
=
paddle_infer
.
get_trt_compile_version
()
if
ver
[
0
]
*
1000
+
ver
[
1
]
*
100
+
ver
[
0
]
*
10
<
7000
:
def
teller
(
program_config
,
predictor_config
):
if
not
predictor_config
.
tensorrt_dynamic_shape_enabled
():
return
True
return
False
self
.
add_skip_case
(
teller
,
SkipReasons
.
TRT_NOT_IMPLEMENTED
,
"Need to repair the case: the output of GPU and tensorrt has diff in trt6, the prelu static plugin has bug."
)
def
test
(
self
):
def
test
(
self
):
self
.
add_skip_trt_case
()
self
.
add_skip_trt_case
()
self
.
run_test
()
self
.
run_test
()
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_reshape.py
浏览文件 @
06bd348d
...
@@ -18,6 +18,7 @@ import numpy as np
...
@@ -18,6 +18,7 @@ import numpy as np
import
paddle.inference
as
paddle_infer
import
paddle.inference
as
paddle_infer
from
functools
import
partial
from
functools
import
partial
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
import
unittest
class
TrtConvertReshapeTest
(
TrtLayerAutoScanTest
):
class
TrtConvertReshapeTest
(
TrtLayerAutoScanTest
):
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_scale.py
浏览文件 @
06bd348d
...
@@ -18,6 +18,7 @@ import numpy as np
...
@@ -18,6 +18,7 @@ import numpy as np
import
paddle.inference
as
paddle_infer
import
paddle.inference
as
paddle_infer
from
functools
import
partial
from
functools
import
partial
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
import
unittest
class
TrtConvertScaleTest
(
TrtLayerAutoScanTest
):
class
TrtConvertScaleTest
(
TrtLayerAutoScanTest
):
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_shuffle_channel.py
浏览文件 @
06bd348d
...
@@ -18,6 +18,7 @@ import numpy as np
...
@@ -18,6 +18,7 @@ import numpy as np
import
paddle.inference
as
paddle_infer
import
paddle.inference
as
paddle_infer
from
functools
import
partial
from
functools
import
partial
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
import
unittest
class
TrtConvertShuffleChannelTest
(
TrtLayerAutoScanTest
):
class
TrtConvertShuffleChannelTest
(
TrtLayerAutoScanTest
):
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_swish.py
浏览文件 @
06bd348d
...
@@ -18,6 +18,7 @@ import numpy as np
...
@@ -18,6 +18,7 @@ import numpy as np
import
paddle.inference
as
paddle_infer
import
paddle.inference
as
paddle_infer
from
functools
import
partial
from
functools
import
partial
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
import
unittest
class
TrtConvertSwishTest
(
TrtLayerAutoScanTest
):
class
TrtConvertSwishTest
(
TrtLayerAutoScanTest
):
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_convert_transpose.py
浏览文件 @
06bd348d
...
@@ -18,6 +18,7 @@ import numpy as np
...
@@ -18,6 +18,7 @@ import numpy as np
import
paddle.inference
as
paddle_infer
import
paddle.inference
as
paddle_infer
from
functools
import
partial
from
functools
import
partial
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
from
typing
import
Optional
,
List
,
Callable
,
Dict
,
Any
,
Set
import
unittest
class
TrtConvertTransposeTest
(
TrtLayerAutoScanTest
):
class
TrtConvertTransposeTest
(
TrtLayerAutoScanTest
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录