Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
8173ff94
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
8173ff94
编写于
3月 23, 2020
作者:
M
mapingshuo
提交者:
GitHub
3月 23, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
delete unused log in Mul grad (#3243)
* rm grad code
上级
8c108172
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
2 addition
and
35 deletion
+2
-35
lite/tests/kernels/mul_grad_compute_test.cc
lite/tests/kernels/mul_grad_compute_test.cc
+2
-35
未找到文件。
lite/tests/kernels/mul_grad_compute_test.cc
浏览文件 @
8173ff94
...
...
@@ -155,18 +155,6 @@ class MulGradTester {
fill_data_rand
(
y
.
data
(),
-
1.
f
,
1.
f
,
y_dims_
.
production
());
this
->
run_forward
(
&
param_
,
&
kernel_
,
x
,
y
,
out
.
data
());
for
(
int
i
=
0
;
i
<
x_dims_
.
production
();
i
++
)
{
LOG
(
INFO
)
<<
"x_"
<<
i
<<
": "
<<
x
[
i
];
}
for
(
int
i
=
0
;
i
<
y_dims_
.
production
();
i
++
)
{
LOG
(
INFO
)
<<
"y_"
<<
i
<<
": "
<<
y
[
i
];
}
for
(
int
i
=
0
;
i
<
out_dims_
.
production
();
i
++
)
{
LOG
(
INFO
)
<<
"out_"
<<
i
<<
": "
<<
out
[
i
];
}
// backward
std
::
vector
<
float
>
out_grad
(
out_dims_
.
production
());
std
::
vector
<
float
>
x_grad
(
x_dims_
.
production
());
...
...
@@ -190,12 +178,7 @@ class MulGradTester {
float
delta
=
0.001
;
float
max_grad_delta
=
0.005
;
for
(
int
i
=
0
;
i
<
x_dims_
.
production
();
i
++
)
{
LOG
(
INFO
)
<<
"--------------------"
;
LOG
(
INFO
)
<<
"delta: "
<<
delta
;
LOG
(
INFO
)
<<
"max_grad_delta: "
<<
max_grad_delta
;
for
(
int
j
=
0
;
j
<
x_dims_
.
production
();
j
++
)
{
// x_delta[j] = i == j ? x[j] + delta : x[j];
if
(
i
==
j
)
{
x_delta
[
j
]
=
x
[
j
]
+
delta
;
}
else
{
...
...
@@ -204,26 +187,12 @@ class MulGradTester {
}
this
->
run_forward
(
&
delta_param_
,
&
delta_kernel_
,
x_delta
,
y
,
out_delta
.
data
());
for
(
int
j
=
0
;
j
<
x_dims_
.
production
();
j
++
)
{
LOG
(
INFO
)
<<
"x_"
<<
j
<<
": "
<<
x
[
j
];
LOG
(
INFO
)
<<
"x_delta_"
<<
j
<<
": "
<<
x_delta
[
j
];
}
for
(
int
j
=
0
;
j
<
y_dims_
.
production
();
j
++
)
{
LOG
(
INFO
)
<<
"y_"
<<
j
<<
": "
<<
y
[
j
];
}
for
(
int
j
=
0
;
j
<
out_dims_
.
production
();
j
++
)
{
LOG
(
INFO
)
<<
"out_delta_"
<<
j
<<
": "
<<
out_delta
[
j
];
}
float
sum
=
0
;
for
(
int
j
=
0
;
j
<
out_dims_
.
production
();
j
++
)
{
sum
+=
(
out_delta
[
j
]
-
out
[
j
]);
}
LOG
(
INFO
)
<<
"x_grad_"
<<
i
<<
": "
<<
x_grad
[
i
];
LOG
(
INFO
)
<<
"x_grad_num_"
<<
i
<<
": "
<<
sum
/
delta
;
EXPECT_NEAR
(
x_grad
[
i
],
sum
/
delta
,
max_grad_delta
);
}
...
...
@@ -237,8 +206,7 @@ class MulGradTester {
for
(
int
j
=
0
;
j
<
out_dims_
.
production
();
j
++
)
{
sum
+=
out_delta
[
j
]
-
out
[
j
];
}
LOG
(
INFO
)
<<
"y_grad_"
<<
i
<<
": "
<<
y_grad
[
i
];
LOG
(
INFO
)
<<
"y_grad_num_"
<<
i
<<
": "
<<
sum
/
delta
;
EXPECT_NEAR
(
y_grad
[
i
],
sum
/
delta
,
max_grad_delta
);
}
}
...
...
@@ -265,8 +233,7 @@ void TestNormalCase(const std::vector<int64_t>& x_dims,
DDim
(
x_dims
),
DDim
(
y_dims
),
x_num_col_dims
,
y_num_col_dims
));
tester
->
prepare_kernel
();
float
delta
=
0.001
;
float
max_grad_delta
=
0.005
;
tester
->
check_grad
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录