Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
a0c41383
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
694
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
You need to sign in or sign up before continuing.
提交
a0c41383
编写于
5月 10, 2018
作者:
R
reyoung
提交者:
yuyang18
5月 10, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish Dctor
上级
b0ca371f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
18 deletion
+18
-18
paddle/fluid/framework/CMakeLists.txt
paddle/fluid/framework/CMakeLists.txt
+1
-1
paddle/fluid/framework/op_proto_maker.h
paddle/fluid/framework/op_proto_maker.h
+17
-17
未找到文件。
paddle/fluid/framework/CMakeLists.txt
浏览文件 @
a0c41383
...
@@ -57,7 +57,7 @@ cc_library(data_transform SRCS data_transform.cc DEPS math_function tensor
...
@@ -57,7 +57,7 @@ cc_library(data_transform SRCS data_transform.cc DEPS math_function tensor
cc_library
(
attribute SRCS attribute.cc DEPS framework_proto boost
)
cc_library
(
attribute SRCS attribute.cc DEPS framework_proto boost
)
cc_test
(
program_desc_test SRCS program_desc_test.cc DEPS proto_desc
cc_test
(
program_desc_test SRCS program_desc_test.cc DEPS proto_desc
device_context
)
device_context
)
cc_library
(
op_proto_maker SRCS op_proto_maker.cc DEPS framework_proto attribute
)
cc_library
(
op_proto_maker SRCS op_proto_maker.cc DEPS framework_proto attribute
glog
)
cc_test
(
op_proto_maker_test SRCS op_proto_maker_test.cc DEPS op_proto_maker
)
cc_test
(
op_proto_maker_test SRCS op_proto_maker_test.cc DEPS op_proto_maker
)
cc_library
(
op_info SRCS op_info.cc DEPS attribute framework_proto
)
cc_library
(
op_info SRCS op_info.cc DEPS attribute framework_proto
)
cc_library
(
shape_inference SRCS shape_inference.cc DEPS ddim attribute device_context
)
cc_library
(
shape_inference SRCS shape_inference.cc DEPS ddim attribute device_context
)
...
...
paddle/fluid/framework/op_proto_maker.h
浏览文件 @
a0c41383
...
@@ -14,9 +14,9 @@ limitations under the License. */
...
@@ -14,9 +14,9 @@ limitations under the License. */
#pragma once
#pragma once
#include <string>
#include <string>
#include "glog/logging.h"
#include "paddle/fluid/framework/attribute.h"
#include "paddle/fluid/framework/attribute.h"
#include "paddle/fluid/framework/framework.pb.h"
#include "paddle/fluid/framework/framework.pb.h"
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
...
@@ -26,45 +26,45 @@ class OpProtoAndCheckerMaker {
...
@@ -26,45 +26,45 @@ class OpProtoAndCheckerMaker {
virtual
void
Make
()
=
0
;
virtual
void
Make
()
=
0
;
virtual
~
OpProtoAndCheckerMaker
()
{
virtual
~
OpProtoAndCheckerMaker
()
{
PADDLE_ENFORCE
(
validated_
,
"should call Validate after build"
)
;
CHECK
(
validated_
)
<<
"should call Validate after build"
;
}
}
void
SetProto
(
proto
::
OpProto
*
proto
)
{
proto_
=
proto
;
}
void
SetProto
(
proto
::
OpProto
*
proto
)
{
proto_
=
proto
;
}
void
SetChecker
(
OpAttrChecker
*
attr_checker
)
{
op_checker_
=
attr_checker
;
}
void
SetChecker
(
OpAttrChecker
*
attr_checker
)
{
op_checker_
=
attr_checker
;
}
void
Validate
();
void
Validate
();
protected:
protected:
struct
VariableBuilder
{
struct
VariableBuilder
{
proto
::
OpProto
::
Var
*
var_
;
proto
::
OpProto
::
Var
*
var_
;
VariableBuilder
&
AsDuplicable
()
{
VariableBuilder
&
AsDuplicable
()
{
var_
->
set_duplicable
(
true
);
var_
->
set_duplicable
(
true
);
return
*
this
;
return
*
this
;
}
}
VariableBuilder
&
AsIntermediate
()
{
VariableBuilder
&
AsIntermediate
()
{
var_
->
set_intermediate
(
true
);
var_
->
set_intermediate
(
true
);
return
*
this
;
return
*
this
;
}
}
VariableBuilder
&
AsDispensable
()
{
VariableBuilder
&
AsDispensable
()
{
var_
->
set_dispensable
(
true
);
var_
->
set_dispensable
(
true
);
return
*
this
;
return
*
this
;
}
}
};
};
VariableBuilder
AddInput
(
const
std
::
string
&
name
,
const
std
::
string
&
comment
);
VariableBuilder
AddInput
(
const
std
::
string
&
name
,
const
std
::
string
&
comment
);
VariableBuilder
AddOutput
(
const
std
::
string
&
name
,
VariableBuilder
AddOutput
(
const
std
::
string
&
name
,
const
std
::
string
&
comment
);
const
std
::
string
&
comment
);
template
<
typename
T
>
template
<
typename
T
>
TypedAttrChecker
<
T
>
&
AddAttr
(
const
std
::
string
&
name
,
TypedAttrChecker
<
T
>
&
AddAttr
(
const
std
::
string
&
name
,
const
std
::
string
&
comment
,
const
std
::
string
&
comment
,
bool
generated
=
false
)
{
bool
generated
=
false
)
{
auto
*
attr
=
proto_
->
add_attrs
();
auto
*
attr
=
proto_
->
add_attrs
();
attr
->
set_name
(
name
);
attr
->
set_name
(
name
);
attr
->
set_comment
(
comment
);
attr
->
set_comment
(
comment
);
attr
->
set_generated
(
generated
);
attr
->
set_generated
(
generated
);
...
@@ -72,13 +72,13 @@ class OpProtoAndCheckerMaker {
...
@@ -72,13 +72,13 @@ class OpProtoAndCheckerMaker {
return
op_checker_
->
AddAttrChecker
<
T
>
(
name
);
return
op_checker_
->
AddAttrChecker
<
T
>
(
name
);
}
}
void
AddComment
(
const
std
::
string
&
comment
)
{
proto_
->
set_comment
(
comment
);
}
void
AddComment
(
const
std
::
string
&
comment
)
{
proto_
->
set_comment
(
comment
);
}
private:
private:
void
CheckNoDuplicatedInOutAttrs
();
void
CheckNoDuplicatedInOutAttrs
();
proto
::
OpProto
*
proto_
;
proto
::
OpProto
*
proto_
;
OpAttrChecker
*
op_checker_
;
OpAttrChecker
*
op_checker_
;
bool
validated_
{
false
};
bool
validated_
{
false
};
};
};
}
// namespace framework
}
// namespace framework
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录