Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
ffaa5252
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
提交
ffaa5252
编写于
10月 02, 2017
作者:
D
dzhwinter
提交者:
GitHub
10月 02, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4550 from dzhwinter/macro
macro header
上级
c705f065
37bbaabd
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
18 addition
and
20 deletion
+18
-20
paddle/framework/block_desc.h
paddle/framework/block_desc.h
+3
-3
paddle/framework/op_info.h
paddle/framework/op_info.h
+3
-5
paddle/framework/program_desc.h
paddle/framework/program_desc.h
+3
-3
paddle/framework/scope.h
paddle/framework/scope.h
+3
-5
paddle/platform/macros.h
paddle/platform/macros.h
+6
-4
未找到文件。
paddle/framework/block_desc.h
浏览文件 @
ffaa5252
...
@@ -19,6 +19,7 @@ limitations under the License. */
...
@@ -19,6 +19,7 @@ limitations under the License. */
#include <vector>
#include <vector>
#include "paddle/framework/op_desc.h"
#include "paddle/framework/op_desc.h"
#include "paddle/framework/var_desc.h"
#include "paddle/framework/var_desc.h"
#include "paddle/platform/macros.h"
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
...
@@ -34,9 +35,6 @@ class BlockDescBind {
...
@@ -34,9 +35,6 @@ class BlockDescBind {
BlockDescBind
(
ProgramDescBind
*
prog
,
BlockDesc
*
desc
)
BlockDescBind
(
ProgramDescBind
*
prog
,
BlockDesc
*
desc
)
:
prog_
(
prog
),
desc_
(
desc
),
need_update_
(
false
)
{}
:
prog_
(
prog
),
desc_
(
desc
),
need_update_
(
false
)
{}
BlockDescBind
(
const
BlockDescBind
&
o
)
=
delete
;
BlockDescBind
&
operator
=
(
const
BlockDescBind
&
o
)
=
delete
;
int32_t
ID
()
const
{
return
desc_
->
idx
();
}
int32_t
ID
()
const
{
return
desc_
->
idx
();
}
int32_t
Parent
()
const
{
return
desc_
->
parent_idx
();
}
int32_t
Parent
()
const
{
return
desc_
->
parent_idx
();
}
...
@@ -66,6 +64,8 @@ class BlockDescBind {
...
@@ -66,6 +64,8 @@ class BlockDescBind {
std
::
deque
<
std
::
unique_ptr
<
OpDescBind
>>
ops_
;
std
::
deque
<
std
::
unique_ptr
<
OpDescBind
>>
ops_
;
std
::
unordered_map
<
std
::
string
,
std
::
unique_ptr
<
VarDescBind
>>
vars_
;
std
::
unordered_map
<
std
::
string
,
std
::
unique_ptr
<
VarDescBind
>>
vars_
;
DISABLE_COPY_AND_ASSIGN
(
BlockDescBind
);
};
};
}
// namespace framework
}
// namespace framework
}
// namespace paddle
}
// namespace paddle
paddle/framework/op_info.h
浏览文件 @
ffaa5252
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "paddle/framework/attribute.h"
#include "paddle/framework/attribute.h"
#include "paddle/framework/op_desc.h"
#include "paddle/framework/op_desc.h"
#include "paddle/framework/type_defs.h"
#include "paddle/framework/type_defs.h"
#include "paddle/platform/macros.h"
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
...
@@ -67,11 +68,6 @@ class OpInfoMap {
...
@@ -67,11 +68,6 @@ class OpInfoMap {
public:
public:
static
OpInfoMap
&
Instance
();
static
OpInfoMap
&
Instance
();
OpInfoMap
(
const
OpInfoMap
&
o
)
=
delete
;
OpInfoMap
(
OpInfoMap
&&
o
)
=
delete
;
OpInfoMap
&
operator
=
(
const
OpInfoMap
&
o
)
=
delete
;
OpInfoMap
&
operator
=
(
OpInfoMap
&&
o
)
=
delete
;
bool
Has
(
const
std
::
string
&
op_type
)
const
{
bool
Has
(
const
std
::
string
&
op_type
)
const
{
return
map_
.
find
(
op_type
)
!=
map_
.
end
();
return
map_
.
find
(
op_type
)
!=
map_
.
end
();
}
}
...
@@ -107,6 +103,8 @@ class OpInfoMap {
...
@@ -107,6 +103,8 @@ class OpInfoMap {
private:
private:
OpInfoMap
()
=
default
;
OpInfoMap
()
=
default
;
std
::
unordered_map
<
std
::
string
,
const
OpInfo
>
map_
;
std
::
unordered_map
<
std
::
string
,
const
OpInfo
>
map_
;
DISABLE_COPY_AND_ASSIGN
(
OpInfoMap
);
};
};
}
// namespace framework
}
// namespace framework
...
...
paddle/framework/program_desc.h
浏览文件 @
ffaa5252
...
@@ -16,6 +16,7 @@ limitations under the License. */
...
@@ -16,6 +16,7 @@ limitations under the License. */
#include <vector>
#include <vector>
#include "paddle/framework/framework.pb.h"
#include "paddle/framework/framework.pb.h"
#include "paddle/platform/macros.h"
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
...
@@ -26,9 +27,6 @@ class ProgramDescBind {
...
@@ -26,9 +27,6 @@ class ProgramDescBind {
public:
public:
static
ProgramDescBind
&
Instance
(
ProgramDesc
*
prog
);
static
ProgramDescBind
&
Instance
(
ProgramDesc
*
prog
);
ProgramDescBind
(
const
ProgramDescBind
&
o
)
=
delete
;
ProgramDescBind
&
operator
=
(
const
ProgramDescBind
&
o
)
=
delete
;
BlockDescBind
*
AppendBlock
(
const
BlockDescBind
&
parent
);
BlockDescBind
*
AppendBlock
(
const
BlockDescBind
&
parent
);
BlockDescBind
*
Block
(
size_t
idx
)
{
return
blocks_
[
idx
].
get
();
}
BlockDescBind
*
Block
(
size_t
idx
)
{
return
blocks_
[
idx
].
get
();
}
...
@@ -46,6 +44,8 @@ class ProgramDescBind {
...
@@ -46,6 +44,8 @@ class ProgramDescBind {
ProgramDesc
*
prog_
;
ProgramDesc
*
prog_
;
std
::
vector
<
std
::
unique_ptr
<
BlockDescBind
>>
blocks_
;
std
::
vector
<
std
::
unique_ptr
<
BlockDescBind
>>
blocks_
;
DISABLE_COPY_AND_ASSIGN
(
ProgramDescBind
);
};
};
}
// namespace framework
}
// namespace framework
}
// namespace paddle
}
// namespace paddle
paddle/framework/scope.h
浏览文件 @
ffaa5252
...
@@ -19,6 +19,7 @@ limitations under the License. */
...
@@ -19,6 +19,7 @@ limitations under the License. */
#include <unordered_map>
#include <unordered_map>
#include "paddle/framework/variable.h"
#include "paddle/framework/variable.h"
#include "paddle/platform/macros.h"
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
...
@@ -38,11 +39,6 @@ class Scope {
...
@@ -38,11 +39,6 @@ class Scope {
Scope
()
{}
Scope
()
{}
~
Scope
();
~
Scope
();
// Disable Copy, Assign, Move.
Scope
(
const
Scope
&
other
)
=
delete
;
Scope
&
operator
=
(
const
Scope
&
other
)
=
delete
;
Scope
(
Scope
&&
other
)
=
delete
;
/// Create a sub-scope. Returns a reference other than a pointer so
/// Create a sub-scope. Returns a reference other than a pointer so
/// to prevent from manual deletion.
/// to prevent from manual deletion.
/// Mark it to const because that new kid scope cannot change parent scope.
/// Mark it to const because that new kid scope cannot change parent scope.
...
@@ -73,6 +69,8 @@ class Scope {
...
@@ -73,6 +69,8 @@ class Scope {
std
::
unordered_map
<
std
::
string
,
Variable
*>
vars_
;
std
::
unordered_map
<
std
::
string
,
Variable
*>
vars_
;
mutable
std
::
list
<
Scope
*>
kids_
;
mutable
std
::
list
<
Scope
*>
kids_
;
Scope
const
*
parent_
{
nullptr
};
Scope
const
*
parent_
{
nullptr
};
DISABLE_COPY_AND_ASSIGN
(
Scope
);
};
};
}
// namespace framework
}
// namespace framework
...
...
paddle/platform/macros.h
浏览文件 @
ffaa5252
...
@@ -19,5 +19,7 @@ limitations under the License. */
...
@@ -19,5 +19,7 @@ limitations under the License. */
#define DISABLE_COPY_AND_ASSIGN(classname) \
#define DISABLE_COPY_AND_ASSIGN(classname) \
private: \
private: \
classname(const classname&) = delete; \
classname(const classname&) = delete; \
classname& operator=(const classname&) = delete
classname(const classname&&) = delete; \
classname& operator=(const classname&) = delete; \
classname& operator=(const classname&&) = delete
#endif
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录