Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
4a52c0cc
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
4a52c0cc
编写于
8月 05, 2021
作者:
W
Wangzheee
提交者:
GitHub
8月 05, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[paddle-trt] fix_teller_reshape (#34583)
上级
6c8a10a2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
2 deletion
+30
-2
paddle/fluid/inference/tensorrt/op_teller.cc
paddle/fluid/inference/tensorrt/op_teller.cc
+3
-2
python/paddle/fluid/tests/unittests/ir/inference/test_trt_reshape_op.py
...fluid/tests/unittests/ir/inference/test_trt_reshape_op.py
+27
-0
未找到文件。
paddle/fluid/inference/tensorrt/op_teller.cc
浏览文件 @
4a52c0cc
...
...
@@ -703,8 +703,9 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
return
false
;
}
// Paddle-TRT does not support the input tensors: Shape and ShapeTensor
if
(
desc
.
Input
(
"Shape"
).
size
()
>=
1
||
desc
.
Input
(
"ShapeTensor"
).
size
()
>=
1
)
{
auto
reshape_inputs
=
desc
.
Inputs
();
if
(
reshape_inputs
.
find
(
"Shape"
)
!=
reshape_inputs
.
end
()
||
reshape_inputs
.
find
(
"ShapeTensor"
)
!=
reshape_inputs
.
end
())
{
return
false
;
}
std
::
vector
<
int
>
shape
=
...
...
python/paddle/fluid/tests/unittests/ir/inference/test_trt_reshape_op.py
浏览文件 @
4a52c0cc
...
...
@@ -80,6 +80,33 @@ class TRTReshapeTest1(TRTReshapeTest):
class
TRTReshapeTest2
(
TRTReshapeTest
):
def
setUp
(
self
):
self
.
bs
=
2
self
.
input_shape
=
[
23
,
13
,
24
]
self
.
reshape
=
[
2
,
0
,
-
1
,
12
]
self
.
data_shape
=
[
self
.
bs
,
self
.
input_shape
[
0
],
self
.
input_shape
[
1
],
self
.
input_shape
[
2
]
]
with
fluid
.
program_guard
(
self
.
main_program
,
self
.
startup_program
):
data
=
fluid
.
data
(
name
=
'data'
,
shape
=
self
.
data_shape
,
dtype
=
'float32'
)
actual_reshape
=
fluid
.
data
(
name
=
'actual_reshape'
,
shape
=
[
4
],
dtype
=
'int32'
)
reshape_out
=
fluid
.
layers
.
reshape
(
x
=
data
,
shape
=
self
.
reshape
,
actual_shape
=
actual_reshape
)
out
=
fluid
.
layers
.
batch_norm
(
reshape_out
,
is_test
=
True
)
self
.
feeds
=
{
'data'
:
np
.
random
.
random
(
self
.
data_shape
).
astype
(
'float32'
),
'actual_reshape'
:
np
.
array
([
2
,
0
,
-
1
,
12
]).
astype
(
'int32'
)
}
self
.
enable_trt
=
True
self
.
trt_parameters
=
TRTReshapeTest
.
TensorRTParam
(
1
<<
30
,
self
.
bs
,
1
,
AnalysisConfig
.
Precision
.
Float32
,
False
,
False
)
self
.
fetch_list
=
[
out
]
class
TRTReshapeTest3
(
TRTReshapeTest
):
def
setUp
(
self
):
self
.
bs
=
1
self
.
input_shape
=
[
14
,
48
,
27
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录