Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
5338417b
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看板
提交
5338417b
编写于
8月 14, 2018
作者:
M
minqiyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish code style
上级
ae39709e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
10 addition
and
13 deletion
+10
-13
paddle/fluid/framework/op_desc.cc
paddle/fluid/framework/op_desc.cc
+3
-3
paddle/fluid/framework/op_desc.h
paddle/fluid/framework/op_desc.h
+1
-1
python/paddle/fluid/backward.py
python/paddle/fluid/backward.py
+1
-2
python/paddle/fluid/parallel_executor.py
python/paddle/fluid/parallel_executor.py
+2
-4
python/paddle/fluid/transpiler/memory_optimization_transpiler.py
...paddle/fluid/transpiler/memory_optimization_transpiler.py
+3
-3
未找到文件。
paddle/fluid/framework/op_desc.cc
浏览文件 @
5338417b
...
@@ -209,7 +209,7 @@ void OpDesc::SetAttr(const std::string &name, const Attribute &v) {
...
@@ -209,7 +209,7 @@ void OpDesc::SetAttr(const std::string &name, const Attribute &v) {
if
(
attr_type
==
proto
::
AttrType
::
INTS
&&
if
(
attr_type
==
proto
::
AttrType
::
INTS
&&
boost
::
get
<
std
::
vector
<
int
>>
(
v
).
size
()
==
0u
)
{
boost
::
get
<
std
::
vector
<
int
>>
(
v
).
size
()
==
0u
)
{
// Find current attr via attr name and set the correct attribute value
// Find current attr via attr name and set the correct attribute value
const
proto
::
OpProto
::
Attr
&
attr
=
GetProtoAttr
(
name
);
const
proto
::
OpProto
::
Attr
&
attr
=
GetProtoAttr
(
name
);
switch
(
attr
.
type
())
{
switch
(
attr
.
type
())
{
case
proto
::
AttrType
::
BOOLEANS
:
{
case
proto
::
AttrType
::
BOOLEANS
:
{
VLOG
(
11
)
<<
"SetAttr: "
<<
Type
()
<<
", "
<<
name
VLOG
(
11
)
<<
"SetAttr: "
<<
Type
()
<<
", "
<<
name
...
@@ -275,8 +275,8 @@ Attribute OpDesc::GetAttr(const std::string &name) const {
...
@@ -275,8 +275,8 @@ Attribute OpDesc::GetAttr(const std::string &name) const {
return
it
->
second
;
return
it
->
second
;
}
}
const
proto
::
OpProto
::
Attr
&
OpDesc
::
GetProtoAttr
(
const
std
::
string
&
name
)
{
const
proto
::
OpProto
::
Attr
&
OpDesc
::
GetProtoAttr
(
const
std
::
string
&
name
)
{
proto
::
OpProto
&
proto
=
OpInfoMap
::
Instance
().
Get
(
Type
()).
Proto
();
proto
::
OpProto
&
proto
=
OpInfoMap
::
Instance
().
Get
(
Type
()).
Proto
();
for
(
int
i
=
0
;
i
!=
proto
.
attrs_size
();
++
i
)
{
for
(
int
i
=
0
;
i
!=
proto
.
attrs_size
();
++
i
)
{
const
proto
::
OpProto
::
Attr
&
attr
=
proto
.
attrs
(
i
);
const
proto
::
OpProto
::
Attr
&
attr
=
proto
.
attrs
(
i
);
if
(
attr
.
name
()
==
name
)
{
if
(
attr
.
name
()
==
name
)
{
...
...
paddle/fluid/framework/op_desc.h
浏览文件 @
5338417b
...
@@ -81,7 +81,7 @@ class OpDesc {
...
@@ -81,7 +81,7 @@ class OpDesc {
Attribute
GetAttr
(
const
std
::
string
&
name
)
const
;
Attribute
GetAttr
(
const
std
::
string
&
name
)
const
;
const
proto
::
OpProto
::
Attr
&
GetProtoAttr
(
const
std
::
string
&
name
)
const
;
const
proto
::
OpProto
::
Attr
&
GetProtoAttr
(
const
std
::
string
&
name
)
const
;
Attribute
GetNullableAttr
(
const
std
::
string
&
name
)
const
;
Attribute
GetNullableAttr
(
const
std
::
string
&
name
)
const
;
...
...
python/paddle/fluid/backward.py
浏览文件 @
5338417b
...
@@ -364,8 +364,7 @@ def _append_backward_ops_(block,
...
@@ -364,8 +364,7 @@ def _append_backward_ops_(block,
# Getting op's corresponding grad_op
# Getting op's corresponding grad_op
grad_op_desc
,
op_grad_to_var
=
core
.
get_grad_op_desc
(
grad_op_desc
,
op_grad_to_var
=
core
.
get_grad_op_desc
(
op
.
desc
,
op
.
desc
,
cpt
.
to_text
(
no_grad_dict
[
block
.
idx
]),
grad_sub_block_list
)
cpt
.
to_text
(
no_grad_dict
[
block
.
idx
]),
grad_sub_block_list
)
grad_op_descs
.
extend
(
grad_op_desc
)
grad_op_descs
.
extend
(
grad_op_desc
)
grad_to_var
.
update
(
op_grad_to_var
)
grad_to_var
.
update
(
op_grad_to_var
)
...
...
python/paddle/fluid/parallel_executor.py
浏览文件 @
5338417b
...
@@ -159,8 +159,7 @@ class ParallelExecutor(object):
...
@@ -159,8 +159,7 @@ class ParallelExecutor(object):
for
p
in
main
.
global_block
().
iter_parameters
()
for
p
in
main
.
global_block
().
iter_parameters
()
if
not
p
.
stop_gradient
if
not
p
.
stop_gradient
]),
]),
set
(
cpt
.
to_text
(
var
)
set
(
cpt
.
to_text
(
var
)
for
var
in
self
.
persistable_vars
),
main
.
desc
,
for
var
in
self
.
persistable_vars
),
main
.
desc
,
cpt
.
to_text
(
loss_name
)
cpt
.
to_text
(
loss_name
)
if
loss_name
else
six
.
u
(
''
),
scope
,
local_scopes
,
exec_strategy
,
if
loss_name
else
six
.
u
(
''
),
scope
,
local_scopes
,
exec_strategy
,
build_strategy
,
num_trainers
,
trainer_id
)
build_strategy
,
num_trainers
,
trainer_id
)
...
@@ -274,8 +273,7 @@ class ParallelExecutor(object):
...
@@ -274,8 +273,7 @@ class ParallelExecutor(object):
self
.
executor
.
feed_tensors_into_local_scopes
(
res
)
self
.
executor
.
feed_tensors_into_local_scopes
(
res
)
fetch_var_name
=
'@FETCHED_VAR_NAME@'
fetch_var_name
=
'@FETCHED_VAR_NAME@'
self
.
executor
.
run
(
self
.
executor
.
run
(
cpt
.
to_text
(
fetch_list
),
cpt
.
to_text
(
fetch_var_name
))
cpt
.
to_text
(
fetch_list
),
cpt
.
to_text
(
fetch_var_name
))
arr
=
self
.
scope
.
find_var
(
fetch_var_name
).
get_lod_tensor_array
()
arr
=
self
.
scope
.
find_var
(
fetch_var_name
).
get_lod_tensor_array
()
if
self
.
is_dist
:
if
self
.
is_dist
:
...
...
python/paddle/fluid/transpiler/memory_optimization_transpiler.py
浏览文件 @
5338417b
...
@@ -259,9 +259,9 @@ class ControlFlowGraph(object):
...
@@ -259,9 +259,9 @@ class ControlFlowGraph(object):
# Rename the var to the cache var already with
# Rename the var to the cache var already with
# memory allocated in order to reuse the memory.
# memory allocated in order to reuse the memory.
_rename_arg_
(
self
.
_ops
,
x
,
cache_var
,
begin_idx
=
i
)
_rename_arg_
(
self
.
_ops
,
x
,
cache_var
,
begin_idx
=
i
)
self
.
_program
.
block
(
block_desc
.
id
).
var
(
self
.
_program
.
block
(
block_desc
.
id
).
var
(
cpt
.
to_text
(
cpt
.
to_text
(
x
)).
desc
=
self
.
_find_var
(
x
)).
desc
=
self
.
_find_var
(
block_desc
,
cache_var
,
block_desc
,
cache_var
,
is_forward
)
is_forward
)
self
.
_update_graph
(
x
,
cache_var
,
begin_idx
=
i
)
self
.
_update_graph
(
x
,
cache_var
,
begin_idx
=
i
)
break
break
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录