Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
a9f7cd34
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
a9f7cd34
编写于
1月 07, 2018
作者:
Y
Yang yaming
提交者:
GitHub
1月 07, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7278 from pkuyym/fix-7216
Bug fix when inserting fill_zeros_like_op.
上级
691b5cac
05c08214
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
5 addition
and
5 deletion
+5
-5
python/paddle/v2/fluid/backward.py
python/paddle/v2/fluid/backward.py
+5
-5
未找到文件。
python/paddle/v2/fluid/backward.py
浏览文件 @
a9f7cd34
...
@@ -7,7 +7,7 @@ __all__ = ['append_backward']
...
@@ -7,7 +7,7 @@ __all__ = ['append_backward']
def
_rename_arg_
(
op_descs
,
old_name
,
new_name
,
begin_idx
=
None
,
end_idx
=
None
):
def
_rename_arg_
(
op_descs
,
old_name
,
new_name
,
begin_idx
=
None
,
end_idx
=
None
):
"""
"""
Traverse all ops in op_descs[begin_idx : end_idx],
Traverse all ops in op_descs[begin_idx : end_idx],
if any op has inputs/outputs named "old_name", rename it as 'new_name'
if any op has inputs/outputs named "old_name", rename it as 'new_name'
"""
"""
if
begin_idx
is
None
:
if
begin_idx
is
None
:
...
@@ -162,7 +162,7 @@ def _remove_no_grad_branch_(op_descs, no_grad_set):
...
@@ -162,7 +162,7 @@ def _remove_no_grad_branch_(op_descs, no_grad_set):
if
core
.
grad_var_suffix
()
in
arg
and
arg
in
no_grad_set
:
if
core
.
grad_var_suffix
()
in
arg
and
arg
in
no_grad_set
:
to_insert
.
append
((
_create_op_desc_
(
"fill_zeros_like"
,
{
to_insert
.
append
((
_create_op_desc_
(
"fill_zeros_like"
,
{
"X"
:
[
_strip_grad_suffix_
(
arg
)]
"X"
:
[
_strip_grad_suffix_
(
arg
)]
},
{
"
Y
"
:
[
arg
]},
{}),
idx
))
},
{
"
Out
"
:
[
arg
]},
{}),
idx
))
map
(
lambda
p
:
op_descs
.
insert
(
p
[
1
],
p
[
0
]),
reversed
(
to_insert
))
map
(
lambda
p
:
op_descs
.
insert
(
p
[
1
],
p
[
0
]),
reversed
(
to_insert
))
...
@@ -182,7 +182,7 @@ def _append_backward_ops_(target,
...
@@ -182,7 +182,7 @@ def _append_backward_ops_(target,
target(Variable): the target variable of forward pass
target(Variable): the target variable of forward pass
block(Block): the block where forward ops are
block(Block): the block where forward ops are
target_block(Block): the block which is going to hold new generated grad ops
target_block(Block): the block which is going to hold new generated grad ops
no_grad_dict(dict):
no_grad_dict(dict):
key(int) block index
key(int) block index
val(set) a set of varibale names. These varibales have no gradient
val(set) a set of varibale names. These varibales have no gradient
grad_to_var(dict)(output argument):
grad_to_var(dict)(output argument):
...
@@ -276,8 +276,8 @@ def append_backward(loss, parameter_list=None, no_grad_set=None):
...
@@ -276,8 +276,8 @@ def append_backward(loss, parameter_list=None, no_grad_set=None):
loss(Variable): The variable generated by cost function.
loss(Variable): The variable generated by cost function.
parameter_list(list): Parameters that need to be updated by optimizer.
parameter_list(list): Parameters that need to be updated by optimizer.
If None, it means all parameters need to be updated.
If None, it means all parameters need to be updated.
no_grad_set(set): Variables that have no gradients in Block 0.
no_grad_set(set): Variables that have no gradients in Block 0.
If None, the set will be generated inside the function and
If None, the set will be generated inside the function and
contains all variables with `step_gradient=True` from all blocks.
contains all variables with `step_gradient=True` from all blocks.
Return:
Return:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录