Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
5932fee6
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看板
未验证
提交
5932fee6
编写于
1月 09, 2021
作者:
Z
zhang wenhui
提交者:
GitHub
1月 09, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enhance error message, test=develop (#30220)
上级
da16b33f
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
22 addition
and
12 deletion
+22
-12
paddle/fluid/operators/cvm_op.cc
paddle/fluid/operators/cvm_op.cc
+15
-8
paddle/fluid/operators/optimizers/ftrl_op.cc
paddle/fluid/operators/optimizers/ftrl_op.cc
+7
-4
未找到文件。
paddle/fluid/operators/cvm_op.cc
浏览文件 @
5932fee6
...
...
@@ -30,8 +30,10 @@ class CVMOp : public framework::OperatorWithKernel {
OP_INOUT_CHECK
(
ctx
->
HasOutput
(
"Y"
),
"Output"
,
"Y"
,
"CVM"
);
auto
x_dims
=
ctx
->
GetInputDim
(
"X"
);
PADDLE_ENFORCE_EQ
(
x_dims
.
size
(),
2UL
,
platform
::
errors
::
InvalidArgument
(
"Input(X)'s rank should be 2."
));
PADDLE_ENFORCE_EQ
(
x_dims
.
size
(),
2UL
,
platform
::
errors
::
InvalidArgument
(
"Input(X)'s rank should be 2, but got %d"
,
x_dims
.
size
()));
if
(
ctx
->
Attrs
().
Get
<
bool
>
(
"use_cvm"
))
{
ctx
->
SetOutputDim
(
"Y"
,
{
x_dims
[
0
],
x_dims
[
1
]});
...
...
@@ -68,26 +70,31 @@ class CVMGradientOp : public framework::OperatorWithKernel {
auto
x_dims
=
ctx
->
GetInputDim
(
"X"
);
auto
cvm_dims
=
ctx
->
GetInputDim
(
"CVM"
);
auto
dy_dims
=
ctx
->
GetInputDim
(
framework
::
GradVarName
(
"Y"
));
PADDLE_ENFORCE_EQ
(
x_dims
.
size
(),
2
,
platform
::
errors
::
InvalidArgument
(
"Input(X)'s rank should be 2."
));
PADDLE_ENFORCE_EQ
(
x_dims
.
size
(),
2
,
platform
::
errors
::
InvalidArgument
(
"Expect Input(X)'s rank == 2, but got %d"
,
x_dims
.
size
()));
PADDLE_ENFORCE_EQ
(
dy_dims
.
size
(),
2
,
platform
::
errors
::
InvalidArgument
(
"Input(Y@Grad)'s rank should be 2."
));
platform
::
errors
::
InvalidArgument
(
"Expect Input(X)'s rank == 2, but got %d"
,
dy_dims
.
size
()));
PADDLE_ENFORCE_EQ
(
cvm_dims
.
size
(),
2
,
platform
::
errors
::
InvalidArgument
(
"Input(CVM)'s rank should be 2."
));
platform
::
errors
::
InvalidArgument
(
"Expect Input(X)'s rank == 2, but got %d"
,
cvm_dims
.
size
()));
PADDLE_ENFORCE_EQ
(
x_dims
[
0
],
dy_dims
[
0
],
platform
::
errors
::
InvalidArgument
(
"The 1st dimension of Input(X) and Input(Y@Grad) should "
"be equal."
));
"be equal, X is %d, Y@Grad is %d"
,
x_dims
[
0
],
dy_dims
[
0
]));
PADDLE_ENFORCE_EQ
(
cvm_dims
[
1
],
2
,
platform
::
errors
::
InvalidArgument
(
"When Attr(soft_label) == false, the 2nd dimension of "
"Input(CVM) should be 2
.
"
));
"Input(CVM) should be 2
, but got %d cvm_dims[1]
"
));
ctx
->
SetOutputDim
(
framework
::
GradVarName
(
"X"
),
x_dims
);
ctx
->
ShareLoD
(
"X"
,
framework
::
GradVarName
(
"X"
));
}
...
...
paddle/fluid/operators/optimizers/ftrl_op.cc
浏览文件 @
5932fee6
...
...
@@ -42,7 +42,9 @@ class FTRLOp : public framework::OperatorWithKernel {
auto
param_dim
=
ctx
->
GetInputDim
(
"Param"
);
PADDLE_ENFORCE_EQ
(
param_dim
,
ctx
->
GetInputDim
(
"Grad"
),
platform
::
errors
::
InvalidArgument
(
"Two input of FTRL Op's dimension must be same."
));
"Two input of FTRL Op's dimension must be same, but "
"param_dim is %d, Grad is %d"
,
param_dim
,
ctx
->
GetInputDim
(
"Grad"
)));
auto
lr_dim
=
ctx
->
GetInputDim
(
"LearningRate"
);
PADDLE_ENFORCE_NE
(
framework
::
product
(
lr_dim
),
0
,
...
...
@@ -51,9 +53,10 @@ class FTRLOp : public framework::OperatorWithKernel {
"been initialized. You may need to confirm "
"if you put exe.run(startup_program) "
"after optimizer.minimize function."
));
PADDLE_ENFORCE_EQ
(
framework
::
product
(
lr_dim
),
1
,
platform
::
errors
::
InvalidArgument
(
"Learning Rate should be a scalar."
));
PADDLE_ENFORCE_EQ
(
framework
::
product
(
lr_dim
),
1
,
platform
::
errors
::
InvalidArgument
(
"Learning Rate should be a scalar, but got %d"
,
framework
::
product
(
lr_dim
)));
ctx
->
SetOutputDim
(
"ParamOut"
,
param_dim
);
ctx
->
SetOutputDim
(
"SquaredAccumOut"
,
param_dim
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录