Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
04e20034
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
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看板
提交
04e20034
编写于
7月 04, 2017
作者:
S
Superjom
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
replace Error with void
上级
c602e046
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
14 addition
and
20 deletion
+14
-20
paddle/framework/net.cc
paddle/framework/net.cc
+3
-8
paddle/framework/net.h
paddle/framework/net.h
+11
-12
未找到文件。
paddle/framework/net.cc
浏览文件 @
04e20034
...
...
@@ -5,20 +5,15 @@ namespace framework {
PlainNet
::
PlainNet
(
const
NetDesc
&
def
)
{}
Error
PlainNet
::
InferShape
(
Scope
*
scope
)
{
void
PlainNet
::
InferShape
(
Scope
*
scope
)
{
for
(
auto
&
op
:
ops_
)
{
// wrong shape
auto
err
=
op
.
InferShape
();
if
(
!
err
)
return
err
;
op
.
InferShape
();
}
// ok
return
Error
();
}
Error
PlainNet
::
Run
(
Scope
*
scope
,
OpContext
*
context
,
OpIndex
begin
,
void
PlainNet
::
Run
(
Scope
*
scope
,
OpContext
*
context
,
OpIndex
begin
,
OpIndex
end
)
const
{
// TODO Add implementation here.
return
Error
();
}
}
// namespace framework
...
...
paddle/framework/net.h
浏览文件 @
04e20034
...
...
@@ -17,7 +17,6 @@
#include "paddle/framework/net_proto.pb.h"
#include "paddle/framework/op_proto.pb.h"
#include "paddle/framework/scope.h"
#include "paddle/utils/Error.h"
namespace
paddle
{
namespace
framework
{
...
...
@@ -38,8 +37,8 @@ struct OpAttrs {};
class
Operator
{
public:
Operator
(
const
OpDesc
&
def
)
{}
Error
InferShape
()
{
return
Error
();
}
Error
Run
()
{
return
Error
();
}
void
InferShape
()
{
}
void
Run
()
{
}
};
/**
...
...
@@ -61,7 +60,7 @@ class Net {
/**
* @brief Infer shapes of all inputs and outputs of operators.
*/
virtual
Error
InferShape
(
Scope
*
scope
)
=
0
;
virtual
void
InferShape
(
Scope
*
scope
)
=
0
;
/**
* @brief Run the network.
*
...
...
@@ -70,7 +69,7 @@ class Net {
* 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.
*/
virtual
Error
Run
(
Scope
*
scope
,
OpContext
*
context
,
OpIndex
begin
=
-
1
,
virtual
void
Run
(
Scope
*
scope
,
OpContext
*
context
,
OpIndex
begin
=
-
1
,
OpIndex
end
=
-
1
)
const
=
0
;
/**
...
...
@@ -81,12 +80,12 @@ class Net {
/**
* @brief Add optimizer operators acctording to `attrs`.
*/
virtual
Error
AddOptimizerOps
(
const
OpAttrs
&
attrs
)
=
0
;
virtual
void
AddOptimizerOps
(
const
OpAttrs
&
attrs
)
=
0
;
/**
* @brief Add backward operators.
*/
virtual
Error
AddBackwardOps
()
=
0
;
virtual
void
AddBackwardOps
()
=
0
;
/**
* @brief Create a network.
...
...
@@ -116,7 +115,7 @@ class PlainNet : public Net {
* Infer all the operators' input and output varialbes' shapes, will be called
* before every mini-batch
*/
virtual
Error
InferShape
(
Scope
*
scope
)
override
;
virtual
void
InferShape
(
Scope
*
scope
)
override
;
/**
* @brief Run the network.
...
...
@@ -125,7 +124,7 @@ class PlainNet : public Net {
* scope will be used instead. If no OpContext is provicded, default context
* will be used.
*/
virtual
Error
Run
(
Scope
*
scope
=
nullptr
,
OpContext
*
context
=
nullptr
,
virtual
void
Run
(
Scope
*
scope
=
nullptr
,
OpContext
*
context
=
nullptr
,
OpIndex
begin
=
-
1
,
OpIndex
end
=
-
1
)
const
override
;
/**
...
...
@@ -136,12 +135,12 @@ class PlainNet : public Net {
/**
* @brief Add all optimizer operators related into the network.
*/
virtual
Error
AddOptimizerOps
(
const
OpAttrs
&
attrs
)
override
;
virtual
void
AddOptimizerOps
(
const
OpAttrs
&
attrs
)
override
;
/**
* @brief Add all backward operators related into the network.
*/
virtual
Error
AddBackwardOps
()
override
;
virtual
void
AddBackwardOps
()
override
;
protected:
/**
...
...
@@ -149,7 +148,7 @@ class PlainNet : public Net {
*
* Create operators accordding to `def`, will be called by the constructor.
*/
Error
BuildNet
(
const
NetDesc
&
def
);
void
BuildNet
(
const
NetDesc
&
def
);
/**
* @brief Add an operator into this network.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录