Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
f5aa8b4d
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
1 年多 前同步成功
通知
696
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看板
提交
f5aa8b4d
编写于
9月 22, 2017
作者:
F
fengjiayi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update namespace of pybind/protobuf.cc and .h
上级
d633bdf1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
4 deletion
+12
-4
paddle/pybind/protobuf.cc
paddle/pybind/protobuf.cc
+9
-2
paddle/pybind/protobuf.h
paddle/pybind/protobuf.h
+2
-2
python/paddle/v2/framework/tests/test_protobuf_descs.py
python/paddle/v2/framework/tests/test_protobuf_descs.py
+1
-0
未找到文件。
paddle/pybind/protobuf.cc
浏览文件 @
f5aa8b4d
...
...
@@ -15,9 +15,10 @@ limitations under the License. */
#include "paddle/pybind/protobuf.h"
namespace
paddle
{
namespace
framework
{
namespace
pybind
{
void
BindProgramDesc
(
py
::
module
&
m
)
{
using
namespace
paddle
::
framework
;
// NOLINT
py
::
class_
<
ProgramDesc
>
(
m
,
"ProgramDesc"
,
""
)
.
def_static
(
"instance"
,
[]
{
return
&
GetProgramDesc
();
},
...
...
@@ -42,10 +43,14 @@ void BindProgramDesc(py::module &m) {
.
def
(
"root_block"
,
[](
ProgramDesc
&
self
)
{
return
self
.
mutable_blocks
()
->
Mutable
(
0
);
},
py
::
return_value_policy
::
reference
)
.
def
(
"block"
,
[](
ProgramDesc
&
self
,
int
id
)
{
return
self
.
blocks
(
id
);
},
py
::
return_value_policy
::
reference
)
.
def
(
"__str__"
,
[](
ProgramDesc
&
self
)
{
return
self
.
DebugString
();
});
}
void
BindBlockDesc
(
py
::
module
&
m
)
{
using
namespace
paddle
::
framework
;
// NOLINT
py
::
class_
<
BlockDesc
>
(
m
,
"BlockDesc"
,
""
)
.
def
(
"id"
,
[](
BlockDesc
&
self
)
{
return
self
.
idx
();
})
.
def
(
"parent"
,
[](
BlockDesc
&
self
)
{
return
self
.
parent_idx
();
})
...
...
@@ -58,6 +63,7 @@ void BindBlockDesc(py::module &m) {
}
void
BindVarDsec
(
py
::
module
&
m
)
{
using
namespace
paddle
::
framework
;
// NOLINT
py
::
class_
<
VarDesc
>
(
m
,
"VarDesc"
,
""
)
.
def
(
py
::
init
<>
())
.
def
(
"set_name"
,
...
...
@@ -86,6 +92,7 @@ void BindVarDsec(py::module &m) {
}
void
BindOpDesc
(
py
::
module
&
m
)
{
using
namespace
paddle
::
framework
;
// NOLINT
auto
op_desc_set_var
=
[](
OpDesc
::
Var
*
var
,
const
std
::
string
&
parameter
,
const
std
::
vector
<
std
::
string
>
&
arguments
)
{
...
...
@@ -132,5 +139,5 @@ void BindOpDesc(py::module &m) {
op_desc_set_attr
(
self
,
name
)
->
set_i
(
i
);
});
}
}
// namespace
framework
}
// namespace
pybind
}
// namespace paddle
paddle/pybind/protobuf.h
浏览文件 @
f5aa8b4d
...
...
@@ -25,7 +25,7 @@ limitations under the License. */
namespace
py
=
pybind11
;
namespace
paddle
{
namespace
framework
{
namespace
pybind
{
template
<
typename
T
>
inline
std
::
vector
<
T
>
RepeatedToVector
(
...
...
@@ -50,5 +50,5 @@ void BindProgramDesc(py::module& m);
void
BindBlockDesc
(
py
::
module
&
m
);
void
BindVarDsec
(
py
::
module
&
m
);
void
BindOpDesc
(
py
::
module
&
m
);
}
// namespace
framework
}
// namespace
pybind
}
// namespace paddle
python/paddle/v2/framework/tests/test_protobuf_descs.py
浏览文件 @
f5aa8b4d
...
...
@@ -23,6 +23,7 @@ class TestProgramDesc(unittest.TestCase):
self
.
assertEqual
(
block_root
.
id
(),
block1
.
parent
())
block3
=
prog_desc
.
append_block
(
block_root
)
self
.
assertEqual
(
block3
.
parent
(),
block_root
.
id
())
self
.
assertEqual
(
prog_desc
.
block
(
1
).
id
(),
1
)
class
TestVarDesc
(
unittest
.
TestCase
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录