Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
18e65b0c
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看板
提交
18e65b0c
编写于
7月 11, 2017
作者:
D
dongzhihong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
"support net_proto header"
上级
983577dc
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
15 addition
and
11 deletion
+15
-11
paddle/framework/CMakeLists.txt
paddle/framework/CMakeLists.txt
+1
-1
paddle/framework/net.cc
paddle/framework/net.cc
+5
-2
paddle/framework/net.h
paddle/framework/net.h
+7
-7
paddle/framework/net_test.cc
paddle/framework/net_test.cc
+1
-1
paddle/platform/device_context.h
paddle/platform/device_context.h
+1
-0
未找到文件。
paddle/framework/CMakeLists.txt
浏览文件 @
18e65b0c
...
@@ -18,4 +18,4 @@ add_custom_target(framework_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch
...
@@ -18,4 +18,4 @@ add_custom_target(framework_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch
add_dependencies
(
framework_py_proto framework_py_proto_init
)
add_dependencies
(
framework_py_proto framework_py_proto_init
)
proto_library
(
net_proto SRCS net_proto.proto DEPS op_proto
)
proto_library
(
net_proto SRCS net_proto.proto DEPS op_proto
)
#
cc_library(net SRCS net.cc DEPS net_proto attr_type op_proto)
cc_library
(
net SRCS net.cc DEPS net_proto attr_type op_proto
)
paddle/framework/net.cc
浏览文件 @
18e65b0c
...
@@ -11,7 +11,10 @@ void PlainNet::InferShape(Scope* scope) {
...
@@ -11,7 +11,10 @@ void PlainNet::InferShape(Scope* scope) {
}
}
}
}
void
PlainNet
::
Run
(
Scope
*
scope
)
const
{}
void
PlainNet
::
Run
(
Scope
*
scope
,
DeviceContext
*
ctx
)
{
for
(
auto
&
op
:
ops_
)
{
op
.
Run
(
ctx
);
}
}
}
// namespace framework
}
// namespace framework
}
// namespace paddle
}
// namespace paddle
paddle/framework/net.h
浏览文件 @
18e65b0c
...
@@ -17,9 +17,11 @@
...
@@ -17,9 +17,11 @@
#include "paddle/framework/net_proto.pb.h"
#include "paddle/framework/net_proto.pb.h"
#include "paddle/framework/op_proto.pb.h"
#include "paddle/framework/op_proto.pb.h"
#include "paddle/framework/scope.h"
#include "paddle/framework/scope.h"
#include "paddle/platform/device_context.h"
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
using
namespace
paddle
::
platform
;
// operator's index stored in a network.
// operator's index stored in a network.
typedef
int
OpIndex
;
typedef
int
OpIndex
;
...
@@ -30,15 +32,13 @@ typedef int OpIndex;
...
@@ -30,15 +32,13 @@ typedef int OpIndex;
*/
*/
struct
OpDesc
;
struct
OpDesc
;
struct
OpDef
;
struct
OpContext
;
struct
OpAttrs
{};
struct
OpAttrs
{};
class
Operator
{
class
Operator
{
public:
public:
Operator
(
const
OpDesc
&
def
)
{}
Operator
(
const
OpDesc
&
def
)
{}
void
InferShape
()
{}
void
InferShape
()
{}
void
Run
()
{}
void
Run
(
DeviceContext
*
ctx
)
{}
};
};
/**
/**
...
@@ -69,12 +69,12 @@ class Net {
...
@@ -69,12 +69,12 @@ class Net {
* environment for ops. `begin` and `end` specify the scope of `ops_` to run,
* environment for ops. `begin` and `end` specify the scope of `ops_` to run,
* If no positive indexes are provided, all operators in `ops_` will run.
* If no positive indexes are provided, all operators in `ops_` will run.
*/
*/
virtual
void
Run
(
Scope
*
scope
)
const
=
0
;
virtual
void
Run
(
Scope
*
scope
,
DeviceContext
*
ctx
)
=
0
;
/**
/**
* @brief Add an Operator according to `def`.
* @brief Add an Operator according to `def`.
*/
*/
virtual
OpIndex
AddOp
(
const
Op
Def
&
def
)
=
0
;
virtual
OpIndex
AddOp
(
const
Op
Proto
&
def
)
=
0
;
/**
/**
* @brief Add optimizer operators acctording to `attrs`.
* @brief Add optimizer operators acctording to `attrs`.
...
@@ -123,12 +123,12 @@ class PlainNet : public Net {
...
@@ -123,12 +123,12 @@ class PlainNet : public Net {
* scope will be used instead. If no OpContext is provicded, default context
* scope will be used instead. If no OpContext is provicded, default context
* will be used.
* will be used.
*/
*/
virtual
void
Run
(
Scope
*
scope
)
const
override
;
virtual
void
Run
(
Scope
*
scope
,
DeviceContext
*
ctx
)
override
;
/**
/**
* @brief Add an operator to this network.
* @brief Add an operator to this network.
*/
*/
virtual
OpIndex
AddOp
(
const
Op
Def
&
def
)
override
;
virtual
OpIndex
AddOp
(
const
Op
Proto
&
def
)
override
;
/**
/**
* @brief Add all optimizer operators related into the network.
* @brief Add all optimizer operators related into the network.
...
...
paddle/framework/net_test.cc
浏览文件 @
18e65b0c
...
@@ -19,6 +19,6 @@
...
@@ -19,6 +19,6 @@
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
class
FakeFC
:
public
Op
Base
{}
class
FakeFC
:
public
Op
erator
{}
}
// namespace framework
}
// namespace framework
}
// namespace paddle
}
// namespace paddle
paddle/platform/device_context.h
浏览文件 @
18e65b0c
...
@@ -36,6 +36,7 @@ class DeviceContext {
...
@@ -36,6 +36,7 @@ class DeviceContext {
class
CPUDeviceContext
:
public
DeviceContext
{};
class
CPUDeviceContext
:
public
DeviceContext
{};
#ifndef PADDLE_ONLY_CPU
#ifndef PADDLE_ONLY_CPU
class
GPUPlaceGuard
{
class
GPUPlaceGuard
{
public:
public:
explicit
GPUPlaceGuard
(
GPUPlace
new_place
)
:
previous_
(
GetCurrentDeviceId
())
{
explicit
GPUPlaceGuard
(
GPUPlace
new_place
)
:
previous_
(
GetCurrentDeviceId
())
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录