Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
9cbf6013
P
Paddle
项目概览
机器未来
/
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看板
未验证
提交
9cbf6013
编写于
4月 27, 2020
作者:
H
HappyAngel
提交者:
GitHub
4月 27, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Cherry-Pick] [2.0-beta] c++ error enhancement (#24189)
上级
53cb2206
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
54 addition
and
59 deletion
+54
-59
paddle/fluid/operators/average_accumulates_op.cc
paddle/fluid/operators/average_accumulates_op.cc
+27
-42
paddle/fluid/operators/get_tensor_from_selected_rows_op.cc
paddle/fluid/operators/get_tensor_from_selected_rows_op.cc
+19
-15
paddle/fluid/operators/tensor_array_to_tensor_op.cc
paddle/fluid/operators/tensor_array_to_tensor_op.cc
+8
-2
未找到文件。
paddle/fluid/operators/average_accumulates_op.cc
浏览文件 @
9cbf6013
...
@@ -48,48 +48,33 @@ class AverageAccumulatesOp : public framework::OperatorWithKernel {
...
@@ -48,48 +48,33 @@ class AverageAccumulatesOp : public framework::OperatorWithKernel {
using
framework
::
OperatorWithKernel
::
OperatorWithKernel
;
using
framework
::
OperatorWithKernel
::
OperatorWithKernel
;
void
InferShape
(
framework
::
InferShapeContext
*
ctx
)
const
override
{
void
InferShape
(
framework
::
InferShapeContext
*
ctx
)
const
override
{
PADDLE_ENFORCE
(
OP_INOUT_CHECK
(
ctx
->
HasInput
(
"param"
),
"Input"
,
"param"
,
ctx
->
HasInput
(
"param"
),
"AverageAccumulates"
);
"Input (param) of average_accumulates op should not be null."
);
OP_INOUT_CHECK
(
ctx
->
HasInput
(
"in_sum_1"
),
"Input"
,
"in_sum_1"
,
PADDLE_ENFORCE
(
"AverageAccumulates"
);
ctx
->
HasInput
(
"in_sum_1"
),
OP_INOUT_CHECK
(
ctx
->
HasInput
(
"in_sum_2"
),
"Input"
,
"in_sum_2"
,
"Input (sum_1) of average_accumulates op should not be null."
);
"AverageAccumulates"
);
PADDLE_ENFORCE
(
OP_INOUT_CHECK
(
ctx
->
HasInput
(
"in_sum_3"
),
"Input"
,
"in_sum_3"
,
ctx
->
HasInput
(
"in_sum_2"
),
"AverageAccumulates"
);
"Input (sum_2) of average_accumulates op should not be null."
);
OP_INOUT_CHECK
(
ctx
->
HasInput
(
"in_num_accumulates"
),
"Input"
,
PADDLE_ENFORCE
(
"in_num_accumulates"
,
"AverageAccumulates"
);
ctx
->
HasInput
(
"in_sum_3"
),
OP_INOUT_CHECK
(
ctx
->
HasInput
(
"in_old_num_accumulates"
),
"Input"
,
"Input (sum_3) of average_accumulates op should not be null."
);
"in_old_num_accumulates"
,
"AverageAccumulates"
);
PADDLE_ENFORCE
(
OP_INOUT_CHECK
(
ctx
->
HasInput
(
"in_num_updates"
),
"Input"
,
"in_num_updates"
,
ctx
->
HasInput
(
"in_num_accumulates"
),
"AverageAccumulates"
);
"Input (in_num_accumulates) of average_accumulates op should "
"not be null."
);
OP_INOUT_CHECK
(
ctx
->
HasOutput
(
"out_sum_1"
),
"Output"
,
"out_sum_1"
,
PADDLE_ENFORCE
(
ctx
->
HasInput
(
"in_old_num_accumulates"
),
"AverageAccumulates"
);
"Input (old_num_accumulates) of average_accumulates op "
OP_INOUT_CHECK
(
ctx
->
HasOutput
(
"out_sum_2"
),
"Output"
,
"out_sum_2"
,
"should not be null."
);
"AverageAccumulates"
);
PADDLE_ENFORCE
(
OP_INOUT_CHECK
(
ctx
->
HasOutput
(
"out_sum_3"
),
"Output"
,
"out_sum_3"
,
ctx
->
HasInput
(
"in_num_updates"
),
"AverageAccumulates"
);
"Input (num_updates) of average_accumulates op should not be null."
);
OP_INOUT_CHECK
(
ctx
->
HasOutput
(
"out_num_accumulates"
),
"Output"
,
"out_num_accumulates"
,
"AverageAccumulates"
);
PADDLE_ENFORCE
(
OP_INOUT_CHECK
(
ctx
->
HasOutput
(
"out_old_num_accumulates"
),
"Output"
,
ctx
->
HasOutput
(
"out_sum_1"
),
"out_old_num_accumulates"
,
"AverageAccumulates"
);
"Output (sum_1) of average_accumulates op should not be null."
);
OP_INOUT_CHECK
(
ctx
->
HasOutput
(
"out_num_updates"
),
"Output"
,
PADDLE_ENFORCE
(
"out_num_updates"
,
"AverageAccumulates"
);
ctx
->
HasOutput
(
"out_sum_2"
),
"Output (sum_2) of average_accumulates op should not be null."
);
PADDLE_ENFORCE
(
ctx
->
HasOutput
(
"out_sum_3"
),
"Output (sum_3) of average_accumulates op should not be null."
);
PADDLE_ENFORCE
(
ctx
->
HasOutput
(
"out_num_accumulates"
),
"Output (num_accumulates) of average_accumulates op should "
"not be null."
);
PADDLE_ENFORCE
(
ctx
->
HasOutput
(
"out_old_num_accumulates"
),
"Output (old_num_accumulates) of average_accumulates op "
"should not be null."
);
PADDLE_ENFORCE
(
ctx
->
HasOutput
(
"out_num_updates"
),
"Output (num_updates) of average_accumulates op should not be null."
);
auto
in_dim
=
ctx
->
GetInputDim
(
"param"
);
auto
in_dim
=
ctx
->
GetInputDim
(
"param"
);
ctx
->
SetOutputDim
(
"out_sum_1"
,
in_dim
);
ctx
->
SetOutputDim
(
"out_sum_1"
,
in_dim
);
...
...
paddle/fluid/operators/get_tensor_from_selected_rows_op.cc
浏览文件 @
9cbf6013
...
@@ -23,21 +23,25 @@ class GetTensorFromSelectedRowsOp : public framework::OperatorWithKernel {
...
@@ -23,21 +23,25 @@ class GetTensorFromSelectedRowsOp : public framework::OperatorWithKernel {
using
framework
::
OperatorWithKernel
::
OperatorWithKernel
;
using
framework
::
OperatorWithKernel
::
OperatorWithKernel
;
void
InferShape
(
framework
::
InferShapeContext
*
ctx
)
const
override
{
void
InferShape
(
framework
::
InferShapeContext
*
ctx
)
const
override
{
PADDLE_ENFORCE
(
ctx
->
HasInput
(
"X"
),
OP_INOUT_CHECK
(
ctx
->
HasInput
(
"X"
),
"Input"
,
"X"
,
"GetTensorFromSelectedRowsOp must have input X."
);
"GetTensorFromSelectedRows"
);
PADDLE_ENFORCE
(
ctx
->
HasOutput
(
"Out"
),
OP_INOUT_CHECK
(
ctx
->
HasOutput
(
"Out"
),
"Output"
,
"Out"
,
"GetTensorFromSelectedRowsOp must have output Out."
);
"GetTensorFromSelectedRows"
);
PADDLE_ENFORCE
(
ctx
->
GetInputsVarType
(
"X"
).
front
()
==
PADDLE_ENFORCE_EQ
(
ctx
->
GetInputsVarType
(
"X"
).
front
(),
framework
::
proto
::
VarType
::
SELECTED_ROWS
,
framework
::
proto
::
VarType
::
SELECTED_ROWS
,
"The input X's type should be SelectedRows, but the received is %s"
,
platform
::
errors
::
InvalidArgument
(
ctx
->
Inputs
(
"X"
).
front
(),
ctx
->
GetInputsVarType
(
"X"
).
front
());
"The input X(%s)'s type should be SelectedRows, "
PADDLE_ENFORCE
(
"but the received is %s"
,
ctx
->
GetOutputsVarType
(
"Out"
).
front
()
==
ctx
->
Inputs
(
"X"
).
front
(),
ctx
->
GetInputsVarType
(
"X"
).
front
()));
PADDLE_ENFORCE_EQ
(
ctx
->
GetOutputsVarType
(
"Out"
).
front
(),
framework
::
proto
::
VarType
::
LOD_TENSOR
,
framework
::
proto
::
VarType
::
LOD_TENSOR
,
"The output Out's type should be LoDTensor, but the received is %s"
,
platform
::
errors
::
InvalidArgument
(
ctx
->
Outputs
(
"Out"
).
front
(),
ctx
->
GetOutputsVarType
(
"Out"
).
front
());
"The output Out(%s)'s type should be LoDTensor, "
"but the received is %s"
,
ctx
->
Outputs
(
"Out"
).
front
(),
ctx
->
GetOutputsVarType
(
"Out"
).
front
()));
ctx
->
SetOutputDim
(
"Out"
,
ctx
->
GetInputDim
(
"X"
));
ctx
->
SetOutputDim
(
"Out"
,
ctx
->
GetInputDim
(
"X"
));
}
}
...
...
paddle/fluid/operators/tensor_array_to_tensor_op.cc
浏览文件 @
9cbf6013
...
@@ -96,7 +96,10 @@ class LoDTensorArray2TensorOp : public framework::OperatorBase {
...
@@ -96,7 +96,10 @@ class LoDTensorArray2TensorOp : public framework::OperatorBase {
*
scope
.
FindVar
(
Output
(
"OutIndex"
))
->
GetMutable
<
framework
::
LoDTensor
>
();
*
scope
.
FindVar
(
Output
(
"OutIndex"
))
->
GetMutable
<
framework
::
LoDTensor
>
();
const
size_t
n
=
inx
.
size
();
const
size_t
n
=
inx
.
size
();
PADDLE_ENFORCE_GT
(
n
,
0
,
"Input tensorarray size should > 0."
);
PADDLE_ENFORCE_GT
(
n
,
0
,
platform
::
errors
::
InvalidArgument
(
"Input tensorarray size should > 0,"
"but the received is %d"
,
n
));
std
::
string
base_name
=
Inputs
(
"X"
)[
0
];
std
::
string
base_name
=
Inputs
(
"X"
)[
0
];
std
::
vector
<
std
::
string
>
names
;
std
::
vector
<
std
::
string
>
names
;
...
@@ -232,7 +235,10 @@ class LoDTensorArray2TensorGradOp : public framework::OperatorBase {
...
@@ -232,7 +235,10 @@ class LoDTensorArray2TensorGradOp : public framework::OperatorBase {
auto
&
inx
=
scope
.
FindVar
(
Input
(
"X"
))
->
Get
<
framework
::
LoDTensorArray
>
();
auto
&
inx
=
scope
.
FindVar
(
Input
(
"X"
))
->
Get
<
framework
::
LoDTensorArray
>
();
const
size_t
n
=
inx
.
size
();
const
size_t
n
=
inx
.
size
();
PADDLE_ENFORCE_GT
(
n
,
0
,
"Input tensorarray size should > 0."
);
PADDLE_ENFORCE_GT
(
n
,
0
,
platform
::
errors
::
InvalidArgument
(
"Input tensorarray size should > 0, "
"but the received is: %d. "
,
n
));
std
::
string
base_name
=
Inputs
(
"X"
)[
0
];
std
::
string
base_name
=
Inputs
(
"X"
)[
0
];
std
::
vector
<
std
::
string
>
names
;
std
::
vector
<
std
::
string
>
names
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录