Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
db82a0e5
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
db82a0e5
编写于
12月 22, 2016
作者:
G
gangliao
提交者:
GitHub
12月 22, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #980 from reyoung/feature/add_const_in_gradient_machine_eval
Add const to GradientMachine::eval
上级
c1b294a3
4d5a0b0a
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
16 addition
and
16 deletion
+16
-16
paddle/gserver/gradientmachines/GradientMachine.h
paddle/gserver/gradientmachines/GradientMachine.h
+2
-2
paddle/gserver/gradientmachines/MultiGradientMachine.cpp
paddle/gserver/gradientmachines/MultiGradientMachine.cpp
+2
-2
paddle/gserver/gradientmachines/MultiGradientMachine.h
paddle/gserver/gradientmachines/MultiGradientMachine.h
+2
-2
paddle/gserver/gradientmachines/MultiNetwork.cpp
paddle/gserver/gradientmachines/MultiNetwork.cpp
+2
-2
paddle/gserver/gradientmachines/MultiNetwork.h
paddle/gserver/gradientmachines/MultiNetwork.h
+2
-2
paddle/gserver/gradientmachines/NeuralNetwork.cpp
paddle/gserver/gradientmachines/NeuralNetwork.cpp
+2
-2
paddle/gserver/gradientmachines/NeuralNetwork.h
paddle/gserver/gradientmachines/NeuralNetwork.h
+2
-2
paddle/gserver/gradientmachines/RecurrentGradientMachine.cpp
paddle/gserver/gradientmachines/RecurrentGradientMachine.cpp
+1
-1
paddle/gserver/gradientmachines/RecurrentGradientMachine.h
paddle/gserver/gradientmachines/RecurrentGradientMachine.h
+1
-1
未找到文件。
paddle/gserver/gradientmachines/GradientMachine.h
浏览文件 @
db82a0e5
...
...
@@ -181,12 +181,12 @@ public:
/**
* Create an evaluator which can be used for eval()
*/
virtual
Evaluator
*
makeEvaluator
()
=
0
;
virtual
Evaluator
*
makeEvaluator
()
const
=
0
;
/**
* evaluate using the given evaluator
*/
virtual
void
eval
(
Evaluator
*
evaluator
)
=
0
;
virtual
void
eval
(
Evaluator
*
evaluator
)
const
=
0
;
std
::
vector
<
ParameterPtr
>&
getParameters
()
{
return
parameters_
;
}
...
...
paddle/gserver/gradientmachines/MultiGradientMachine.cpp
浏览文件 @
db82a0e5
...
...
@@ -327,11 +327,11 @@ void MultiGradientMachine::finish() {
}
}
Evaluator
*
MultiGradientMachine
::
makeEvaluator
()
{
Evaluator
*
MultiGradientMachine
::
makeEvaluator
()
const
{
return
threads_
[
0
]
->
getGradientMachine
()
->
makeEvaluator
();
}
void
MultiGradientMachine
::
eval
(
Evaluator
*
evaluator
)
{
void
MultiGradientMachine
::
eval
(
Evaluator
*
evaluator
)
const
{
for
(
auto
&
thread
:
threads_
)
{
SetDevice
device
(
thread
->
getDeviceId
());
thread
->
getGradientMachine
()
->
eval
(
evaluator
);
...
...
paddle/gserver/gradientmachines/MultiGradientMachine.h
浏览文件 @
db82a0e5
...
...
@@ -193,9 +193,9 @@ public:
virtual
void
finish
();
virtual
Evaluator
*
makeEvaluator
();
virtual
Evaluator
*
makeEvaluator
()
const
;
virtual
void
eval
(
Evaluator
*
evaluator
);
virtual
void
eval
(
Evaluator
*
evaluator
)
const
;
bool
useGpu
()
const
{
return
useGpu_
;
}
...
...
paddle/gserver/gradientmachines/MultiNetwork.cpp
浏览文件 @
db82a0e5
...
...
@@ -171,7 +171,7 @@ protected:
std
::
vector
<
std
::
unique_ptr
<
Evaluator
>>
evaluators_
;
};
Evaluator
*
MultiNetwork
::
makeEvaluator
()
{
Evaluator
*
MultiNetwork
::
makeEvaluator
()
const
{
MultiCombinedEvaluator
*
multiCombinedEvaluator
=
new
MultiCombinedEvaluator
();
for
(
size_t
i
=
0
;
i
<
subNetworks_
.
size
();
i
++
)
{
std
::
unique_ptr
<
Evaluator
>
evaluator
(
subNetworks_
[
i
]
->
makeEvaluator
());
...
...
@@ -180,6 +180,6 @@ Evaluator* MultiNetwork::makeEvaluator() {
return
multiCombinedEvaluator
;
}
void
MultiNetwork
::
eval
(
Evaluator
*
evaluator
)
{
evaluator
->
eval
(
*
this
);
}
void
MultiNetwork
::
eval
(
Evaluator
*
evaluator
)
const
{
evaluator
->
eval
(
*
this
);
}
}
// namespace paddle
paddle/gserver/gradientmachines/MultiNetwork.h
浏览文件 @
db82a0e5
...
...
@@ -46,9 +46,9 @@ public:
virtual
void
onPassEnd
();
virtual
Evaluator
*
makeEvaluator
();
virtual
Evaluator
*
makeEvaluator
()
const
;
virtual
void
eval
(
Evaluator
*
evaluator
);
virtual
void
eval
(
Evaluator
*
evaluator
)
const
;
const
std
::
vector
<
std
::
unique_ptr
<
NeuralNetwork
>>&
getSubNetworks
()
const
{
return
subNetworks_
;
...
...
paddle/gserver/gradientmachines/NeuralNetwork.cpp
浏览文件 @
db82a0e5
...
...
@@ -348,7 +348,7 @@ protected:
std
::
vector
<
std
::
unique_ptr
<
Evaluator
>>
evaluators_
;
};
Evaluator
*
NeuralNetwork
::
makeEvaluator
()
{
Evaluator
*
NeuralNetwork
::
makeEvaluator
()
const
{
CombinedEvaluator
*
combinedEvaluator
=
new
CombinedEvaluator
();
auto
subModelConfig
=
std
::
find_if
(
config_
.
sub_models
().
begin
(),
config_
.
sub_models
().
end
(),
...
...
@@ -383,7 +383,7 @@ Evaluator* NeuralNetwork::makeEvaluator() {
return
combinedEvaluator
;
}
void
NeuralNetwork
::
eval
(
Evaluator
*
evaluator
)
{
evaluator
->
eval
(
*
this
);
}
void
NeuralNetwork
::
eval
(
Evaluator
*
evaluator
)
const
{
evaluator
->
eval
(
*
this
);
}
void
NeuralNetwork
::
setOutputGrad
(
const
std
::
vector
<
Argument
>&
args
)
{
CHECK_GE
(
outputLayers_
.
size
(),
args
.
size
());
...
...
paddle/gserver/gradientmachines/NeuralNetwork.h
浏览文件 @
db82a0e5
...
...
@@ -96,9 +96,9 @@ public:
virtual
void
onPassEnd
();
virtual
Evaluator
*
makeEvaluator
();
virtual
Evaluator
*
makeEvaluator
()
const
;
virtual
void
eval
(
Evaluator
*
evaluator
);
virtual
void
eval
(
Evaluator
*
evaluator
)
const
;
virtual
void
resetState
();
virtual
void
setOutputGrad
(
const
std
::
vector
<
Argument
>&
args
);
...
...
paddle/gserver/gradientmachines/RecurrentGradientMachine.cpp
浏览文件 @
db82a0e5
...
...
@@ -593,7 +593,7 @@ void RecurrentGradientMachine::forwardBackward(
LOG
(
FATAL
)
<<
"should not use this function"
;
}
void
RecurrentGradientMachine
::
eval
(
Evaluator
*
evaluator
)
{
void
RecurrentGradientMachine
::
eval
(
Evaluator
*
evaluator
)
const
{
// call printers frame by frame
for
(
int
i
=
0
;
i
<
maxSequenceLength_
;
++
i
)
{
LOG
(
INFO
)
<<
"Recurrent Layer Group eval frame "
<<
i
<<
" begin"
;
...
...
paddle/gserver/gradientmachines/RecurrentGradientMachine.h
浏览文件 @
db82a0e5
...
...
@@ -63,7 +63,7 @@ public:
const
UpdateCallback
&
callback
);
virtual
void
resetState
()
{}
virtual
void
eval
(
Evaluator
*
evaluator
);
virtual
void
eval
(
Evaluator
*
evaluator
)
const
;
const
std
::
vector
<
int
>&
getParameterIds
()
{
return
parameterIds_
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录