Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
SummerGao.
Paddle
提交
dd4c2d86
P
Paddle
项目概览
SummerGao.
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
0
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
dd4c2d86
编写于
9月 22, 2020
作者:
石
石晓伟
提交者:
GitHub
9月 22, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enhance error messages, test=develop (#27423)
上级
b7371fa5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
23 addition
and
11 deletion
+23
-11
paddle/fluid/inference/capi/pd_predictor.cc
paddle/fluid/inference/capi/pd_predictor.cc
+2
-1
paddle/fluid/operators/fused/fusion_seqpool_cvm_concat_op.cc
paddle/fluid/operators/fused/fusion_seqpool_cvm_concat_op.cc
+21
-10
未找到文件。
paddle/fluid/inference/capi/pd_predictor.cc
浏览文件 @
dd4c2d86
...
...
@@ -130,7 +130,8 @@ bool PD_PredictorZeroCopyRun(const PD_AnalysisConfig* config,
VLOG
(
3
)
<<
"The inputs' size is "
<<
input_names
.
size
();
PADDLE_ENFORCE_EQ
(
input_names
.
size
(),
in_size
,
"The number of input and the number of model's input must match. "
);
paddle
::
platform
::
errors
::
InvalidArgument
(
"The number of input and the number of model's input must match."
));
for
(
int
i
=
0
;
i
<
in_size
;
++
i
)
{
auto
input_t
=
predictor
->
GetInputTensor
(
inputs
[
i
].
name
);
std
::
vector
<
int
>
tensor_shape
;
...
...
paddle/fluid/operators/fused/fusion_seqpool_cvm_concat_op.cc
浏览文件 @
dd4c2d86
...
...
@@ -24,20 +24,27 @@ void FusionSeqPoolCVMConcatOp::InferShape(
framework
::
InferShapeContext
*
ctx
)
const
{
PADDLE_ENFORCE_GE
(
ctx
->
Inputs
(
"X"
).
size
(),
1UL
,
"Inputs(X) of FusionSeqPoolCVMConcatOp should not be empty."
);
PADDLE_ENFORCE
(
ctx
->
HasOutput
(
"Out"
),
"Output(Out) of FusionSeqPoolCVMConcatOp should not be null."
);
paddle
::
platform
::
errors
::
InvalidArgument
(
"Inputs(X) of FusionSeqPoolCVMConcatOp should not be empty."
));
PADDLE_ENFORCE
(
ctx
->
HasOutput
(
"Out"
),
paddle
::
platform
::
errors
::
InvalidArgument
(
"Output(Out) of FusionSeqPoolCVMConcatOp should not be null."
));
int
axis
=
ctx
->
Attrs
().
Get
<
int
>
(
"axis"
);
PADDLE_ENFORCE_EQ
(
axis
,
1
,
"FusionSeqPoolCVMConcatOp only supports concat axis=1 yet."
);
axis
,
1
,
paddle
::
platform
::
errors
::
InvalidArgument
(
"FusionSeqPoolCVMConcatOp only supports concat axis=1 yet."
));
bool
use_cvm
=
ctx
->
Attrs
().
Get
<
bool
>
(
"use_cvm"
);
PADDLE_ENFORCE_EQ
(
use_cvm
,
true
,
"FusionSeqPoolCVMConcatOp only supports use_cvm is true yet."
);
paddle
::
platform
::
errors
::
InvalidArgument
(
"FusionSeqPoolCVMConcatOp only supports use_cvm is true yet."
));
auto
ins_dims
=
ctx
->
GetInputsDim
(
"X"
);
const
size_t
n
=
ins_dims
.
size
();
PADDLE_ENFORCE_GT
(
n
,
0UL
,
"Input tensors count should > 0."
);
PADDLE_ENFORCE_GT
(
n
,
0UL
,
paddle
::
platform
::
errors
::
InvalidArgument
(
"Input tensors count should > 0."
));
if
(
n
==
1
)
{
LOG
(
WARNING
)
<<
"Only have one input, may waste memory"
;
}
...
...
@@ -45,7 +52,8 @@ void FusionSeqPoolCVMConcatOp::InferShape(
// The output height should be confirmed in Compute,
// since input lod is not accessible here.
PADDLE_ENFORCE_EQ
(
ins_dims
[
0
].
size
(),
2
,
"The dims size of first input should be 2."
);
paddle
::
platform
::
errors
::
InvalidArgument
(
"The dims size of first input should be 2."
));
ctx
->
SetOutputDim
(
"Out"
,
{
-
1
,
ins_dims
[
0
][
axis
]
*
static_cast
<
int
>
(
n
)});
}
...
...
@@ -99,7 +107,8 @@ class FusionSeqPoolCVMConcatKernel : public framework::OpKernel<T> {
int
w
=
ins
[
0
]
->
numel
()
/
x0_dims
[
0
];
PADDLE_ENFORCE_EQ
(
y_dims
[
1
]
%
w
,
0
,
"The output of dims[1] should be dividable of w"
);
paddle
::
platform
::
errors
::
InvalidArgument
(
"The output of dims[1] should be dividable of w"
));
jit
::
seq_pool_attr_t
attr
(
w
,
jit
::
SeqPoolType
::
kSum
);
if
(
pooltype
==
"AVERAGE"
)
{
attr
.
type
=
jit
::
SeqPoolType
::
kAvg
;
...
...
@@ -117,9 +126,11 @@ class FusionSeqPoolCVMConcatKernel : public framework::OpKernel<T> {
const
T
*
src
=
ins
[
i
]
->
data
<
T
>
();
T
*
dst
=
y_data
+
i
*
w
;
PADDLE_ENFORCE_EQ
(
static_cast
<
int
>
(
ins
[
i
]
->
numel
()
/
x_dims
[
0
]),
w
,
"Width of all inputs should be equal."
);
paddle
::
platform
::
errors
::
InvalidArgument
(
"Width of all inputs should be equal."
));
PADDLE_ENFORCE_EQ
(
x_lod
.
size
(),
bs
+
1
,
"Batchsize of all inputs should be equal."
);
paddle
::
platform
::
errors
::
InvalidArgument
(
"Batchsize of all inputs should be equal."
));
for
(
size_t
j
=
0
;
j
<
bs
;
++
j
)
{
attr
.
h
=
static_cast
<
int
>
(
x_lod
[
j
+
1
]
-
x_lod
[
j
]);
seqpool
(
src
,
dst
,
&
attr
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录