Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
edd3587e
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看板
提交
edd3587e
编写于
4月 24, 2018
作者:
A
Abhinav Arora
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix CPPLint errors with op_desc
上级
f09aed04
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
10 addition
and
9 deletion
+10
-9
paddle/fluid/framework/op_desc.cc
paddle/fluid/framework/op_desc.cc
+2
-2
paddle/fluid/framework/op_desc.h
paddle/fluid/framework/op_desc.h
+2
-1
paddle/fluid/framework/program_desc.cc
paddle/fluid/framework/program_desc.cc
+2
-2
paddle/fluid/operators/conditional_block_op.cc
paddle/fluid/operators/conditional_block_op.cc
+1
-1
paddle/fluid/operators/parallel_do_op.cc
paddle/fluid/operators/parallel_do_op.cc
+1
-1
paddle/fluid/operators/recurrent_op.cc
paddle/fluid/operators/recurrent_op.cc
+1
-1
paddle/fluid/operators/while_op.cc
paddle/fluid/operators/while_op.cc
+1
-1
未找到文件。
paddle/fluid/framework/op_desc.cc
浏览文件 @
edd3587e
...
@@ -205,8 +205,8 @@ void OpDesc::SetAttr(const std::string &name, const Attribute &v) {
...
@@ -205,8 +205,8 @@ void OpDesc::SetAttr(const std::string &name, const Attribute &v) {
need_update_
=
true
;
need_update_
=
true
;
}
}
void
OpDesc
::
SetBlockAttr
(
const
std
::
string
&
name
,
BlockDesc
&
block
)
{
void
OpDesc
::
SetBlockAttr
(
const
std
::
string
&
name
,
BlockDesc
*
block
)
{
this
->
attrs_
[
name
]
=
&
block
;
this
->
attrs_
[
name
]
=
block
;
need_update_
=
true
;
need_update_
=
true
;
}
}
...
...
paddle/fluid/framework/op_desc.h
浏览文件 @
edd3587e
...
@@ -14,6 +14,7 @@ limitations under the License. */
...
@@ -14,6 +14,7 @@ limitations under the License. */
#pragma once
#pragma once
#include <string>
#include <unordered_map>
#include <unordered_map>
#include <vector>
#include <vector>
#include "paddle/fluid/framework/attribute.h"
#include "paddle/fluid/framework/attribute.h"
...
@@ -73,7 +74,7 @@ class OpDesc {
...
@@ -73,7 +74,7 @@ class OpDesc {
void
SetAttr
(
const
std
::
string
&
name
,
const
Attribute
&
v
);
void
SetAttr
(
const
std
::
string
&
name
,
const
Attribute
&
v
);
void
SetBlockAttr
(
const
std
::
string
&
name
,
BlockDesc
&
block
);
void
SetBlockAttr
(
const
std
::
string
&
name
,
BlockDesc
*
block
);
Attribute
GetAttr
(
const
std
::
string
&
name
)
const
;
Attribute
GetAttr
(
const
std
::
string
&
name
)
const
;
...
...
paddle/fluid/framework/program_desc.cc
浏览文件 @
edd3587e
...
@@ -56,7 +56,7 @@ ProgramDesc::ProgramDesc(const ProgramDesc &o) {
...
@@ -56,7 +56,7 @@ ProgramDesc::ProgramDesc(const ProgramDesc &o) {
for
(
const
auto
&
attr
:
op
->
Proto
()
->
attrs
())
{
for
(
const
auto
&
attr
:
op
->
Proto
()
->
attrs
())
{
if
(
attr
.
type
()
==
proto
::
AttrType
::
BLOCK
)
{
if
(
attr
.
type
()
==
proto
::
AttrType
::
BLOCK
)
{
size_t
blk_idx
=
attr
.
block_idx
();
size_t
blk_idx
=
attr
.
block_idx
();
op
->
SetBlockAttr
(
attr
.
name
(),
*
this
->
MutableBlock
(
blk_idx
));
op
->
SetBlockAttr
(
attr
.
name
(),
this
->
MutableBlock
(
blk_idx
));
}
}
}
}
}
}
...
@@ -73,7 +73,7 @@ ProgramDesc::ProgramDesc(const proto::ProgramDesc &desc) {
...
@@ -73,7 +73,7 @@ ProgramDesc::ProgramDesc(const proto::ProgramDesc &desc) {
for
(
const
auto
&
attr
:
op
->
Proto
()
->
attrs
())
{
for
(
const
auto
&
attr
:
op
->
Proto
()
->
attrs
())
{
if
(
attr
.
type
()
==
proto
::
AttrType
::
BLOCK
)
{
if
(
attr
.
type
()
==
proto
::
AttrType
::
BLOCK
)
{
size_t
blk_idx
=
attr
.
block_idx
();
size_t
blk_idx
=
attr
.
block_idx
();
op
->
SetBlockAttr
(
attr
.
name
(),
*
this
->
MutableBlock
(
blk_idx
));
op
->
SetBlockAttr
(
attr
.
name
(),
this
->
MutableBlock
(
blk_idx
));
}
}
}
}
}
}
...
...
paddle/fluid/operators/conditional_block_op.cc
浏览文件 @
edd3587e
...
@@ -227,7 +227,7 @@ class ConditionalBlockGradMaker : public framework::SingleGradOpDescMaker {
...
@@ -227,7 +227,7 @@ class ConditionalBlockGradMaker : public framework::SingleGradOpDescMaker {
grad_op
->
SetOutput
(
framework
::
GradVarName
(
"X"
),
InputGrad
(
"X"
,
false
));
grad_op
->
SetOutput
(
framework
::
GradVarName
(
"X"
),
InputGrad
(
"X"
,
false
));
grad_op
->
SetOutput
(
framework
::
GradVarName
(
"Params"
),
grad_op
->
SetOutput
(
framework
::
GradVarName
(
"Params"
),
InputGrad
(
"Params"
,
false
));
InputGrad
(
"Params"
,
false
));
grad_op
->
SetBlockAttr
(
"sub_block"
,
*
this
->
grad_block_
[
0
]);
grad_op
->
SetBlockAttr
(
"sub_block"
,
this
->
grad_block_
[
0
]);
grad_op
->
SetAttr
(
"is_scalar_condition"
,
GetAttr
(
"is_scalar_condition"
));
grad_op
->
SetAttr
(
"is_scalar_condition"
,
GetAttr
(
"is_scalar_condition"
));
return
std
::
unique_ptr
<
framework
::
OpDesc
>
(
grad_op
);
return
std
::
unique_ptr
<
framework
::
OpDesc
>
(
grad_op
);
}
}
...
...
paddle/fluid/operators/parallel_do_op.cc
浏览文件 @
edd3587e
...
@@ -364,7 +364,7 @@ class ParallelDoGradOpDescMaker : public framework::SingleGradOpDescMaker {
...
@@ -364,7 +364,7 @@ class ParallelDoGradOpDescMaker : public framework::SingleGradOpDescMaker {
}
}
}
}
grad
->
SetAttrMap
(
this
->
Attrs
());
grad
->
SetAttrMap
(
this
->
Attrs
());
grad
->
SetBlockAttr
(
kParallelBlock
,
*
grad_block_
[
0
]);
grad
->
SetBlockAttr
(
kParallelBlock
,
grad_block_
[
0
]);
return
std
::
unique_ptr
<
framework
::
OpDesc
>
(
grad
);
return
std
::
unique_ptr
<
framework
::
OpDesc
>
(
grad
);
}
}
...
...
paddle/fluid/operators/recurrent_op.cc
浏览文件 @
edd3587e
...
@@ -596,7 +596,7 @@ class RecurrentGradOpDescMaker : public framework::SingleGradOpDescMaker {
...
@@ -596,7 +596,7 @@ class RecurrentGradOpDescMaker : public framework::SingleGradOpDescMaker {
}
}
}
}
grad
->
SetAttrMap
(
this
->
Attrs
());
grad
->
SetAttrMap
(
this
->
Attrs
());
grad
->
SetBlockAttr
(
kStepBlock
,
*
grad_block_
[
0
]);
grad
->
SetBlockAttr
(
kStepBlock
,
grad_block_
[
0
]);
return
std
::
unique_ptr
<
framework
::
OpDesc
>
(
grad
);
return
std
::
unique_ptr
<
framework
::
OpDesc
>
(
grad
);
}
}
...
...
paddle/fluid/operators/while_op.cc
浏览文件 @
edd3587e
...
@@ -288,7 +288,7 @@ class WhileGradOpDescMaker : public framework::SingleGradOpDescMaker {
...
@@ -288,7 +288,7 @@ class WhileGradOpDescMaker : public framework::SingleGradOpDescMaker {
while_grad
->
SetInput
(
framework
::
GradVarName
(
kOutputs
),
output_grads_list
);
while_grad
->
SetInput
(
framework
::
GradVarName
(
kOutputs
),
output_grads_list
);
while_grad
->
SetAttrMap
(
this
->
Attrs
());
while_grad
->
SetAttrMap
(
this
->
Attrs
());
while_grad
->
SetBlockAttr
(
kStepBlock
,
*
grad_block
);
while_grad
->
SetBlockAttr
(
kStepBlock
,
grad_block
);
// record the original output gradient names, since the gradient name of
// record the original output gradient names, since the gradient name of
// while operator could be renamed.
// while operator could be renamed.
while_grad
->
SetAttr
(
"original_output_grad"
,
output_grads_list
);
while_grad
->
SetAttr
(
"original_output_grad"
,
output_grads_list
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录