Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
6285edbb
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看板
提交
6285edbb
编写于
9月 27, 2017
作者:
F
fengjiayi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix compile errors
上级
54ef4cda
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
74 addition
and
77 deletion
+74
-77
paddle/framework/CMakeLists.txt
paddle/framework/CMakeLists.txt
+1
-2
paddle/framework/block_desc.cc
paddle/framework/block_desc.cc
+3
-4
paddle/framework/block_desc.h
paddle/framework/block_desc.h
+5
-5
paddle/framework/op_desc.cc
paddle/framework/op_desc.cc
+3
-3
paddle/framework/op_desc.h
paddle/framework/op_desc.h
+2
-2
paddle/framework/program_desc.cc
paddle/framework/program_desc.cc
+4
-4
paddle/framework/program_desc.h
paddle/framework/program_desc.h
+2
-2
paddle/framework/var_desc.cc
paddle/framework/var_desc.cc
+2
-2
paddle/framework/var_desc.h
paddle/framework/var_desc.h
+2
-2
paddle/pybind/CMakeLists.txt
paddle/pybind/CMakeLists.txt
+1
-1
paddle/pybind/protobuf.cc
paddle/pybind/protobuf.cc
+49
-50
未找到文件。
paddle/framework/CMakeLists.txt
浏览文件 @
6285edbb
...
...
@@ -18,9 +18,8 @@ cc_test(scope_test SRCS scope_test.cc DEPS scope)
proto_library
(
framework_proto SRCS framework.proto
)
cc_library
(
var_desc SRCS var_desc.cc DEPS framework_proto
)
cc_library
(
attribute SRCS attribute.cc DEPS framework_proto
)
cc_library
(
proto_desc SRCS var_desc.cc op_desc.cc block_desc.cc program_desc.cc DEPS attribute
)
cc_library
(
op_proto_maker SRCS op_proto_maker.cc DEPS framework_proto attribute
)
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
)
...
...
paddle/framework/block_desc.cc
浏览文件 @
6285edbb
...
...
@@ -13,8 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/framework/block_desc.h"
#include "paddle/framework/op_desc.h"
#include "paddle/framework/var_desc.h"
#include "paddle/framework/program_desc.h"
namespace
paddle
{
namespace
framework
{
...
...
@@ -86,5 +85,5 @@ void OpDescBind::SetBlockAttr(const std::string &name, BlockDescBind &block) {
BlockDesc
*
desc
=
block
.
RawPtr
();
this
->
attrs_
[
name
]
=
desc
;
}
}
}
\ No newline at end of file
}
// namespace framework
}
// namespace paddle
paddle/framework/block_desc.h
浏览文件 @
6285edbb
...
...
@@ -14,16 +14,16 @@ limitations under the License. */
#pragma once
#include <deque>
#include <unordered_map>
#include <vector>
#include "paddle/framework/framework.pb.h"
#include "paddle/framework/op_desc.h"
#include "paddle/framework/var_desc.h"
namespace
paddle
{
namespace
framework
{
class
ProgramDescBind
;
class
OpDescBind
;
class
VarDescBind
;
// Each Protobuf Message, we provide a XXXBind class. In that class, we optimize
// read/write speed. Only when we want the protobuf message, the local changes
...
...
@@ -67,5 +67,5 @@ class BlockDescBind {
std
::
deque
<
std
::
unique_ptr
<
OpDescBind
>>
ops_
;
std
::
unordered_map
<
std
::
string
,
std
::
unique_ptr
<
VarDescBind
>>
vars_
;
};
}
}
}
// namespace framework
}
// namespace paddle
paddle/framework/op_desc.cc
浏览文件 @
6285edbb
...
...
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/framework/op_desc.h"
#include "paddle/framewor
d
/block_desc.h"
#include "paddle/framewor
k
/block_desc.h"
namespace
paddle
{
namespace
framework
{
...
...
@@ -129,5 +129,5 @@ void OpDescBind::Sync() {
need_update_
=
false
;
}
}
}
}
\ No newline at end of file
}
// namespace framework
}
// namespace paddle
paddle/framework/op_desc.h
浏览文件 @
6285edbb
...
...
@@ -102,5 +102,5 @@ class OpDescBind {
// local changes should be synchronized, need_update_ should be set to true.
bool
need_update_
{
false
};
};
}
}
}
// namespace framework
}
// namespace paddle
paddle/framework/program_desc.cc
浏览文件 @
6285edbb
...
...
@@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/f
armework/block
_desc.h"
#include "paddle/framework/
programe
_desc.h"
#include "paddle/f
ramework/program
_desc.h"
#include "paddle/framework/
block
_desc.h"
namespace
paddle
{
namespace
framework
{
...
...
@@ -56,5 +56,5 @@ ProgramDescBind::ProgramDescBind(ProgramDesc *prog) {
blocks_
.
emplace_back
(
new
BlockDescBind
(
this
,
&
block
));
}
}
}
}
\ No newline at end of file
}
// namespace framework
}
// namespace paddle
paddle/framework/program
e
_desc.h
→
paddle/framework/program_desc.h
浏览文件 @
6285edbb
...
...
@@ -47,5 +47,5 @@ class ProgramDescBind {
std
::
vector
<
std
::
unique_ptr
<
BlockDescBind
>>
blocks_
;
};
}
}
}
// namespace framework
}
// namespace paddle
paddle/framework/var_desc.cc
浏览文件 @
6285edbb
...
...
@@ -32,5 +32,5 @@ std::vector<int64_t> VarDescBind::Shape() const {
DataType
VarDescBind
::
DataType
()
const
{
return
desc_
.
lod_tensor
().
data_type
();
}
}
}
\ No newline at end of file
}
// namespace framework
}
// namespace paddle
paddle/framework/var_desc.h
浏览文件 @
6285edbb
...
...
@@ -69,5 +69,5 @@ class VarDescBind {
private:
VarDesc
desc_
;
};
}
}
}
// namespace framework
}
// namespace paddle
paddle/pybind/CMakeLists.txt
浏览文件 @
6285edbb
if
(
WITH_PYTHON
)
cc_library
(
paddle_pybind SHARED
SRCS pybind.cc exception.cc protobuf.cc
DEPS pybind python backward
DEPS pybind python backward
proto_desc
${
GLOB_OP_LIB
}
)
endif
(
WITH_PYTHON
)
paddle/pybind/protobuf.cc
浏览文件 @
6285edbb
...
...
@@ -94,61 +94,61 @@ struct type_caster<boost::variant<Args...>>
namespace
paddle
{
namespace
pybind
{
using
namespace
paddle
::
framework
;
// NOLINT
// Bind Methods
void
BindProgramDesc
(
py
::
module
&
m
)
{
py
::
class_
<
framework
::
ProgramDescBind
>
(
m
,
"ProgramDesc"
,
""
)
.
def_static
(
"instance"
,
[]()
->
framework
::
ProgramDescBind
*
{
return
&
framework
::
ProgramDescBind
::
Instance
(
&
GetProgramDesc
());
},
py
::
return_value_policy
::
reference
)
py
::
class_
<
ProgramDescBind
>
(
m
,
"ProgramDesc"
,
""
)
.
def_static
(
"instance"
,
[]()
->
ProgramDescBind
*
{
return
&
ProgramDescBind
::
Instance
(
&
GetProgramDesc
());
},
py
::
return_value_policy
::
reference
)
.
def_static
(
"__create_program_desc__"
,
[]()
->
framework
::
ProgramDescBind
*
{
[]()
->
ProgramDescBind
*
{
// Only used for unit-test
auto
*
prog_desc
=
new
ProgramDesc
;
auto
*
block
=
prog_desc
->
mutable_blocks
()
->
Add
();
block
->
set_idx
(
0
);
block
->
set_parent_idx
(
-
1
);
return
&
framework
::
ProgramDescBind
::
Instance
(
prog_desc
);
return
&
ProgramDescBind
::
Instance
(
prog_desc
);
},
py
::
return_value_policy
::
reference
)
.
def
(
"append_block"
,
&
framework
::
ProgramDescBind
::
AppendBlock
,
.
def
(
"append_block"
,
&
ProgramDescBind
::
AppendBlock
,
py
::
return_value_policy
::
reference
)
.
def
(
"block"
,
&
framework
::
ProgramDescBind
::
Block
,
py
::
return_value_policy
::
reference
)
.
def
(
"__str__"
,
&
framework
::
ProgramDescBind
::
DebugString
)
.
def
(
"num_blocks"
,
&
framework
::
ProgramDescBind
::
Size
);
.
def
(
"block"
,
&
ProgramDescBind
::
Block
,
py
::
return_value_policy
::
reference
)
.
def
(
"__str__"
,
&
ProgramDescBind
::
DebugString
)
.
def
(
"num_blocks"
,
&
ProgramDescBind
::
Size
);
}
void
BindBlockDesc
(
py
::
module
&
m
)
{
py
::
class_
<
framework
::
BlockDescBind
>
(
m
,
"BlockDesc"
,
""
)
.
def_property_readonly
(
"id"
,
&
framework
::
BlockDescBind
::
ID
)
.
def_property_readonly
(
"parent"
,
&
framework
::
BlockDescBind
::
Parent
)
.
def
(
"append_op"
,
&
framework
::
BlockDescBind
::
AppendOp
,
py
::
class_
<
BlockDescBind
>
(
m
,
"BlockDesc"
,
""
)
.
def_property_readonly
(
"id"
,
&
BlockDescBind
::
ID
)
.
def_property_readonly
(
"parent"
,
&
BlockDescBind
::
Parent
)
.
def
(
"append_op"
,
&
BlockDescBind
::
AppendOp
,
py
::
return_value_policy
::
reference
)
.
def
(
"prepend_op"
,
&
framework
::
BlockDescBind
::
PrependOp
,
.
def
(
"prepend_op"
,
&
BlockDescBind
::
PrependOp
,
py
::
return_value_policy
::
reference
)
.
def
(
"new_var"
,
[](
framework
::
BlockDescBind
&
self
,
py
::
bytes
byte_name
)
{
[](
BlockDescBind
&
self
,
py
::
bytes
byte_name
)
{
std
::
string
name
=
byte_name
;
return
self
.
NewVar
(
name
);
},
py
::
return_value_policy
::
reference
)
.
def
(
"var"
,
[](
framework
::
BlockDescBind
&
self
,
py
::
bytes
byte_name
)
{
[](
BlockDescBind
&
self
,
py
::
bytes
byte_name
)
{
std
::
string
name
=
byte_name
;
return
self
.
Var
(
name
);
},
py
::
return_value_policy
::
reference
)
.
def
(
"all_vars"
,
&
framework
::
BlockDescBind
::
AllVars
,
.
def
(
"all_vars"
,
&
BlockDescBind
::
AllVars
,
py
::
return_value_policy
::
reference
)
.
def
(
"all_ops"
,
&
framework
::
BlockDescBind
::
AllOps
,
.
def
(
"all_ops"
,
&
BlockDescBind
::
AllOps
,
py
::
return_value_policy
::
reference
);
}
void
BindVarDsec
(
py
::
module
&
m
)
{
py
::
enum_
<
framework
::
DataType
>
(
m
,
"DataType"
,
""
)
py
::
enum_
<
DataType
>
(
m
,
"DataType"
,
""
)
.
value
(
"BOOL"
,
DataType
::
BOOL
)
.
value
(
"INT16"
,
DataType
::
INT16
)
.
value
(
"INT32"
,
DataType
::
INT32
)
...
...
@@ -157,22 +157,21 @@ void BindVarDsec(py::module &m) {
.
value
(
"FP32"
,
DataType
::
FP32
)
.
value
(
"FP64"
,
DataType
::
FP64
);
py
::
class_
<
framework
::
VarDescBind
>
(
m
,
"VarDesc"
,
""
)
py
::
class_
<
VarDescBind
>
(
m
,
"VarDesc"
,
""
)
.
def
(
"name"
,
[](
const
framework
::
framework
::
VarDescBind
&
self
)
{
[](
const
VarDescBind
&
self
)
{
py
::
bytes
name
=
self
.
Name
();
return
name
;
},
py
::
return_value_policy
::
reference
)
.
def
(
"set_shape"
,
&
framework
::
VarDescBind
::
SetShape
)
.
def
(
"set_data_type"
,
&
framework
::
VarDescBind
::
SetDataType
)
.
def
(
"shape"
,
&
framework
::
VarDescBind
::
Shape
,
py
::
return_value_policy
::
reference
)
.
def
(
"data_type"
,
&
framework
::
VarDescBind
::
DataType
);
.
def
(
"set_shape"
,
&
VarDescBind
::
SetShape
)
.
def
(
"set_data_type"
,
&
VarDescBind
::
SetDataType
)
.
def
(
"shape"
,
&
VarDescBind
::
Shape
,
py
::
return_value_policy
::
reference
)
.
def
(
"data_type"
,
&
VarDescBind
::
DataType
);
}
void
BindOpDesc
(
py
::
module
&
m
)
{
py
::
enum_
<
framework
::
AttrType
>
(
m
,
"AttrType"
,
""
)
py
::
enum_
<
AttrType
>
(
m
,
"AttrType"
,
""
)
.
value
(
"INT"
,
AttrType
::
INT
)
.
value
(
"INTS"
,
AttrType
::
INTS
)
.
value
(
"FLOAT"
,
AttrType
::
FLOAT
)
...
...
@@ -183,24 +182,24 @@ void BindOpDesc(py::module &m) {
.
value
(
"BOOLS"
,
AttrType
::
BOOLEANS
)
.
value
(
"BLOCK"
,
AttrType
::
BLOCK
);
py
::
class_
<
framework
::
OpDescBind
>
op_desc
(
m
,
"OpDesc"
,
""
);
op_desc
.
def
(
"type"
,
&
framework
::
OpDescBind
::
Type
)
.
def
(
"set_type"
,
&
framework
::
OpDescBind
::
SetType
)
.
def
(
"input"
,
&
framework
::
OpDescBind
::
Input
)
.
def
(
"input_names"
,
&
framework
::
OpDescBind
::
InputNames
)
.
def
(
"set_input"
,
&
framework
::
OpDescBind
::
SetInput
)
.
def
(
"output"
,
&
framework
::
OpDescBind
::
Output
)
.
def
(
"output_names"
,
&
framework
::
OpDescBind
::
OutputNames
)
.
def
(
"set_output"
,
&
framework
::
OpDescBind
::
SetOutput
)
.
def
(
"__str__"
,
&
framework
::
OpDescBind
::
DebugString
)
.
def
(
"__repr__"
,
&
framework
::
OpDescBind
::
DebugString
)
.
def
(
"has_attr"
,
&
framework
::
OpDescBind
::
HasAttr
)
.
def
(
"attr_type"
,
&
framework
::
OpDescBind
::
GetAttrType
)
.
def
(
"attr_names"
,
&
framework
::
OpDescBind
::
AttrNames
)
.
def
(
"set_attr"
,
&
framework
::
OpDescBind
::
SetAttr
)
.
def
(
"attr"
,
&
framework
::
OpDescBind
::
GetAttr
)
.
def
(
"set_block_attr"
,
&
framework
::
OpDescBind
::
SetBlockAttr
)
.
def
(
"get_block_attr"
,
&
framework
::
OpDescBind
::
GetBlockAttr
);
py
::
class_
<
OpDescBind
>
op_desc
(
m
,
"OpDesc"
,
""
);
op_desc
.
def
(
"type"
,
&
OpDescBind
::
Type
)
.
def
(
"set_type"
,
&
OpDescBind
::
SetType
)
.
def
(
"input"
,
&
OpDescBind
::
Input
)
.
def
(
"input_names"
,
&
OpDescBind
::
InputNames
)
.
def
(
"set_input"
,
&
OpDescBind
::
SetInput
)
.
def
(
"output"
,
&
OpDescBind
::
Output
)
.
def
(
"output_names"
,
&
OpDescBind
::
OutputNames
)
.
def
(
"set_output"
,
&
OpDescBind
::
SetOutput
)
.
def
(
"__str__"
,
&
OpDescBind
::
DebugString
)
.
def
(
"__repr__"
,
&
OpDescBind
::
DebugString
)
.
def
(
"has_attr"
,
&
OpDescBind
::
HasAttr
)
.
def
(
"attr_type"
,
&
OpDescBind
::
GetAttrType
)
.
def
(
"attr_names"
,
&
OpDescBind
::
AttrNames
)
.
def
(
"set_attr"
,
&
OpDescBind
::
SetAttr
)
.
def
(
"attr"
,
&
OpDescBind
::
GetAttr
)
.
def
(
"set_block_attr"
,
&
OpDescBind
::
SetBlockAttr
)
.
def
(
"get_block_attr"
,
&
OpDescBind
::
GetBlockAttr
);
}
}
// namespace pybind
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录