Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
6767d0fc
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看板
提交
6767d0fc
编写于
11月 22, 2016
作者:
D
dangqingqing
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of
https://github.com/baidu/Paddle
into cn_doc
上级
448156e4
5fdaa966
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
61 addition
and
44 deletion
+61
-44
doc_cn/concepts/use_concepts.rst
doc_cn/concepts/use_concepts.rst
+1
-1
paddle/gserver/evaluators/CTCErrorEvaluator.cpp
paddle/gserver/evaluators/CTCErrorEvaluator.cpp
+1
-1
paddle/gserver/evaluators/ChunkEvaluator.cpp
paddle/gserver/evaluators/ChunkEvaluator.cpp
+1
-1
paddle/gserver/evaluators/Evaluator.cpp
paddle/gserver/evaluators/Evaluator.cpp
+3
-3
paddle/gserver/evaluators/Evaluator.h
paddle/gserver/evaluators/Evaluator.h
+8
-8
paddle/gserver/gradientmachines/MultiNetwork.cpp
paddle/gserver/gradientmachines/MultiNetwork.cpp
+1
-1
paddle/gserver/gradientmachines/NeuralNetwork.cpp
paddle/gserver/gradientmachines/NeuralNetwork.cpp
+1
-1
paddle/math/BaseMatrix.cu
paddle/math/BaseMatrix.cu
+10
-10
paddle/math/Vector.cpp
paddle/math/Vector.cpp
+3
-3
paddle/pserver/ParameterServer2.cpp
paddle/pserver/ParameterServer2.cpp
+0
-2
paddle/utils/BarrierStat.cpp
paddle/utils/BarrierStat.cpp
+5
-5
paddle/utils/BarrierStat.h
paddle/utils/BarrierStat.h
+6
-5
paddle/utils/CompilerMacros.h
paddle/utils/CompilerMacros.h
+17
-0
paddle/utils/Logging.cpp
paddle/utils/Logging.cpp
+2
-2
paddle/utils/Logging.h
paddle/utils/Logging.h
+2
-1
未找到文件。
doc_cn/concepts/use_concepts.rst
浏览文件 @
6767d0fc
...
...
@@ -54,7 +54,7 @@ trainer进程会调用DataProvider函数,将用户的原始数据转换成系
.. literalinclude:: trainer_config.py
:linenos:
文件开头 ``from paddle.trainer_config_helpers import *`` ,是因为PaddlePaddle配置文件与C++模块通信的最基础协议是protobuf
。为了避免用户直接写复杂的protobuf string,我们为用户定以Python接口来配置网络,该Python代码可以生成protobuf包,这就是的作用
`trainer_config_helpers`_的作用。因此,在文件的开始,需要import这些函数。 这个包里面包含了模型配置需要的各个模块。
文件开头 ``from paddle.trainer_config_helpers import *`` ,是因为PaddlePaddle配置文件与C++模块通信的最基础协议是protobuf
,为了避免用户直接写复杂的protobuf string,我们为用户定以Python接口来配置网络,该Python代码可以生成protobuf包,这就是
`trainer_config_helpers`_的作用。因此,在文件的开始,需要import这些函数。 这个包里面包含了模型配置需要的各个模块。
下面分别介绍DataConfig、OptimizationConfig、ModelConfig这三部分该概念。
...
...
paddle/gserver/evaluators/CTCErrorEvaluator.cpp
浏览文件 @
6767d0fc
...
...
@@ -240,7 +240,7 @@ public:
seqClassficationError_
=
0
;
}
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
os
<<
config_
.
name
()
<<
"="
<<
(
numSequences_
?
totalScore_
/
numSequences_
:
0
);
os
<<
" deletions error"
...
...
paddle/gserver/evaluators/ChunkEvaluator.cpp
浏览文件 @
6767d0fc
...
...
@@ -114,7 +114,7 @@ public:
numCorrect_
=
0
;
}
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
double
precision
=
(
double
)
numCorrect_
/
numOutputSegments_
;
double
recall
=
(
double
)
numCorrect_
/
numLabelSegments_
;
double
f1
=
...
...
paddle/gserver/evaluators/Evaluator.cpp
浏览文件 @
6767d0fc
...
...
@@ -315,7 +315,7 @@ public:
return
0
;
}
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
CHECK
(
colIdx_
+
(
int32_t
)
colNum_
>=
0
&&
colIdx_
-
(
int32_t
)
colNum_
<
0
)
<<
"column index ["
<<
colIdx_
<<
"] out of range [-"
<<
colNum_
<<
", "
<<
colNum_
<<
")"
;
...
...
@@ -421,7 +421,7 @@ void AucEvaluator::distributeEval(ParameterClient2* client) {
client
->
reduce
(
statNeg_
,
statNeg_
,
kBinNum_
+
1
,
FLAGS_trainer_id
,
0
);
}
double
AucEvaluator
::
calcAuc
()
{
double
AucEvaluator
::
calcAuc
()
const
{
double
totPos
=
0.0
;
double
totNeg
=
0.0
;
double
totPosPrev
=
0.0
;
...
...
@@ -584,7 +584,7 @@ real PrecisionRecallEvaluator::evalImp(std::vector<Argument>& arguments) {
return
0
;
}
void
PrecisionRecallEvaluator
::
printStats
(
std
::
ostream
&
os
)
{
void
PrecisionRecallEvaluator
::
printStats
(
std
::
ostream
&
os
)
const
{
int
label
=
config_
.
positive_label
();
if
(
label
!=
-
1
)
{
CHECK
(
label
>=
0
&&
label
<
(
int
)
statsInfo_
.
size
())
...
...
paddle/gserver/evaluators/Evaluator.h
浏览文件 @
6767d0fc
...
...
@@ -99,19 +99,19 @@ public:
* @brief print the statistics of evaluate result
* @note finish() should be called before printStats
*/
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
os
<<
config_
.
name
()
<<
"="
<<
(
numSamples_
?
totalScore_
/
numSamples_
:
0
);
}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
Evaluator
&
evaluator
)
{
const
Evaluator
&
evaluator
)
{
evaluator
.
printStats
(
os
);
return
os
;
}
friend
std
::
ostream
&&
operator
<<
(
std
::
ostream
&&
os
,
// NOLINT
Evaluator
&
evaluator
)
{
const
Evaluator
&
evaluator
)
{
evaluator
.
printStats
(
os
);
return
std
::
move
(
os
);
}
...
...
@@ -135,7 +135,7 @@ public:
return
-
1
;
}
virtual
void
finish
()
{}
virtual
void
printStats
(
std
::
ostream
&
)
{}
virtual
void
printStats
(
std
::
ostream
&
)
const
{}
};
/**
* @brief evaluate AUC using colIdx-th column as prediction.
...
...
@@ -165,7 +165,7 @@ public:
virtual
real
evalImp
(
std
::
vector
<
Argument
>&
arguments
);
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
os
<<
config_
.
name
()
<<
"="
<<
calcAuc
();
}
...
...
@@ -189,7 +189,7 @@ private:
return
(
X1
>
X2
?
(
X1
-
X2
)
:
(
X2
-
X1
))
*
(
Y1
+
Y2
)
/
2.0
;
}
double
calcAuc
();
double
calcAuc
()
const
;
};
/**
...
...
@@ -244,7 +244,7 @@ public:
virtual
real
evalImp
(
std
::
vector
<
Argument
>&
arguments
);
virtual
void
printStats
(
std
::
ostream
&
os
);
virtual
void
printStats
(
std
::
ostream
&
os
)
const
;
virtual
void
distributeEval
(
ParameterClient2
*
client
);
...
...
@@ -339,7 +339,7 @@ public:
virtual
void
finish
()
{
calc
(
predictArray_
);
}
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
os
<<
" pos/neg"
<<
"="
<<
pairArray_
[
0
]
/
((
pairArray_
[
1
]
<=
0
)
?
1.0
:
pairArray_
[
1
]);
}
...
...
paddle/gserver/gradientmachines/MultiNetwork.cpp
浏览文件 @
6767d0fc
...
...
@@ -154,7 +154,7 @@ public:
return
-
1
;
}
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
for
(
auto
&
evaluator
:
evaluators_
)
{
evaluator
->
printStats
(
os
);
os
<<
' '
;
...
...
paddle/gserver/gradientmachines/NeuralNetwork.cpp
浏览文件 @
6767d0fc
...
...
@@ -325,7 +325,7 @@ public:
(
void
)
arguments
;
return
-
1
;
}
virtual
void
printStats
(
std
::
ostream
&
os
)
{
virtual
void
printStats
(
std
::
ostream
&
os
)
const
{
for
(
auto
&
evaluator
:
evaluators_
)
{
evaluator
->
printStats
(
os
);
os
<<
' '
;
...
...
paddle/math/BaseMatrix.cu
浏览文件 @
6767d0fc
...
...
@@ -1449,8 +1449,8 @@ template<>
template
<
class
Agg
>
int
BaseMatrixT
<
real
>::
applyRow
(
Agg
agg
,
BaseMatrixT
&
b
)
{
MatrixOffset
offset
(
0
,
0
,
0
,
0
,
0
,
0
);
in
t
numRows
=
b
.
height_
;
in
t
numCols
=
b
.
width_
;
size_
t
numRows
=
b
.
height_
;
size_
t
numCols
=
b
.
width_
;
CHECK_EQ
(
height_
,
numRows
);
CHECK_EQ
(
width_
,
1UL
);
aggregate
(
agg
,
base
::
unary
::
identity
(),
base
::
binary
::
second
(),
b
,
numRows
,
...
...
@@ -1463,8 +1463,8 @@ template<>
template
<
class
Agg
,
class
Saver
>
int
BaseMatrixT
<
real
>::
applyRow
(
Agg
agg
,
Saver
sv
,
BaseMatrixT
&
b
)
{
MatrixOffset
offset
(
0
,
0
,
0
,
0
,
0
,
0
);
in
t
numRows
=
b
.
height_
;
in
t
numCols
=
b
.
width_
;
size_
t
numRows
=
b
.
height_
;
size_
t
numCols
=
b
.
width_
;
CHECK_EQ
(
height_
,
numRows
);
CHECK_EQ
(
width_
,
1UL
);
aggregate
(
agg
,
base
::
unary
::
identity
(),
sv
,
b
,
numRows
,
numCols
,
offset
,
...
...
@@ -1493,8 +1493,8 @@ template <class Agg, class Op, class Saver>
int
BaseMatrixT
<
real
>::
applyRow
(
Agg
agg
,
Op
op
,
Saver
sv
,
BaseMatrixT
&
b
,
BaseMatrixT
&
c
)
{
MatrixOffset
offset
(
0
,
0
,
0
,
0
,
0
,
0
);
in
t
numRows
=
b
.
height_
;
in
t
numCols
=
b
.
width_
;
size_
t
numRows
=
b
.
height_
;
size_
t
numCols
=
b
.
width_
;
CHECK_EQ
(
height_
,
numRows
);
CHECK_EQ
(
width_
,
1UL
);
CHECK_EQ
(
c
.
height_
,
numRows
);
...
...
@@ -1524,8 +1524,8 @@ template<>
template
<
class
Agg
>
int
BaseMatrixT
<
real
>::
applyCol
(
Agg
agg
,
BaseMatrixT
&
b
)
{
MatrixOffset
offset
(
0
,
0
,
0
,
0
,
0
,
0
);
in
t
numRows
=
b
.
height_
;
in
t
numCols
=
b
.
width_
;
size_
t
numRows
=
b
.
height_
;
size_
t
numCols
=
b
.
width_
;
CHECK_EQ
(
width_
,
numCols
);
CHECK_EQ
(
height_
,
1UL
);
aggregate
(
agg
,
base
::
unary
::
identity
(),
base
::
binary
::
second
(),
b
,
numRows
,
...
...
@@ -1538,8 +1538,8 @@ template<>
template
<
class
Agg
,
class
Saver
>
int
BaseMatrixT
<
real
>::
applyCol
(
Agg
agg
,
Saver
sv
,
BaseMatrixT
&
b
)
{
MatrixOffset
offset
(
0
,
0
,
0
,
0
,
0
,
0
);
in
t
numRows
=
b
.
height_
;
in
t
numCols
=
b
.
width_
;
size_
t
numRows
=
b
.
height_
;
size_
t
numCols
=
b
.
width_
;
CHECK_EQ
(
width_
,
numCols
);
CHECK_EQ
(
height_
,
1UL
);
aggregate
(
agg
,
base
::
unary
::
identity
(),
sv
,
b
,
numRows
,
numCols
,
offset
,
...
...
paddle/math/Vector.cpp
浏览文件 @
6767d0fc
...
...
@@ -82,8 +82,8 @@ MatrixPtr VectorT<real>::toOneHotSparseMatrix(size_t idRange, bool useGpu) {
template
<
>
MatrixPtr
VectorT
<
int
>::
toOneHotSparseMatrix
(
size_t
idRange
,
bool
useGpu
)
{
in
t
height
=
getSize
();
in
t
width
=
idRange
;
size_
t
height
=
getSize
();
size_
t
width
=
idRange
;
MatrixPtr
mat
=
Matrix
::
createSparseMatrix
(
height
,
idRange
,
height
,
NO_VALUE
,
SPARSE_CSR
,
false
,
useGpu
);
...
...
@@ -91,7 +91,7 @@ MatrixPtr VectorT<int>::toOneHotSparseMatrix(size_t idRange, bool useGpu) {
cpuIds
.
copyFrom
(
*
this
);
int
*
idData
=
cpuIds
.
getData
();
for
(
int
i
=
0
;
i
<
height
;
i
++
)
{
for
(
decltype
(
height
)
i
=
0
;
i
<
height
;
i
++
)
{
const
unsigned
int
id
=
idData
[
i
];
CHECK_LT
(
id
,
width
);
mat
->
setRow
(
i
,
1
,
&
id
,
nullptr
);
...
...
paddle/pserver/ParameterServer2.cpp
浏览文件 @
6767d0fc
...
...
@@ -1469,7 +1469,6 @@ void ParameterServer2::waitPassFinish(const WaitPassFinishRequest& request,
void
ParameterServer2
::
synchronize
(
const
SynchronizeRequest
&
request
,
ProtoResponseCallback
callback
)
{
CHECK_LT
(
request
.
sync_object_id
(),
SyncObject_ARRAYSIZE
);
synchronizeBarriers_
[
request
.
sync_object_id
()]
->
wait
();
dataSize_
=
0
;
callback
(
SynchronizeResponse
());
...
...
@@ -1477,7 +1476,6 @@ void ParameterServer2::synchronize(const SynchronizeRequest& request,
void
ParameterServer2
::
asyncFinishPass
(
const
SynchronizeRequest
&
request
,
ProtoResponseCallback
callback
)
{
CHECK_LT
(
request
.
sync_object_id
(),
SyncObject_ARRAYSIZE
);
synchronizeBarriers_
[
request
.
sync_object_id
()]
->
wait
();
callback
(
SynchronizeResponse
());
...
...
paddle/utils/BarrierStat.cpp
浏览文件 @
6767d0fc
...
...
@@ -29,10 +29,10 @@ P_DEFINE_bool(log_barrier_show_log, false, // for performance tuning insight
namespace
paddle
{
std
::
ostream
&
operator
<<
(
std
::
ostream
&
output
,
BarrierStatBase
&
stat
)
{
std
::
ostream
&
operator
<<
(
std
::
ostream
&
output
,
const
BarrierStatBase
&
stat
)
{
if
(
FLAGS_log_barrier_abstract
)
{
std
::
lock_guard
<
std
::
mutex
>
guard
(
const_cast
<
BarrierStatBase
&>
(
stat
).
lock_
);
std
::
lock_guard
<
std
::
mutex
>
guard
(
stat
.
lock_
);
stat
.
showAbstract
(
output
);
}
return
output
;
...
...
@@ -136,7 +136,7 @@ void BarrierEndStat::reset(bool clearRawData) {
totAbstract_
.
minDelta
=
UINT64_MAX
;
}
void
BarrierEndStat
::
showAbstract
(
std
::
ostream
&
output
)
{
void
BarrierEndStat
::
showAbstract
(
std
::
ostream
&
output
)
const
{
// do not support the case "<=2 pserver"
if
(
numConnThreads_
<=
2
||
!
totSamples_
)
{
return
;
...
...
@@ -272,7 +272,7 @@ void BarrierDeltaStat::reset(bool clearRawData) {
totAbstract_
.
minDelta
=
UINT64_MAX
;
}
void
BarrierDeltaStat
::
showAbstract
(
std
::
ostream
&
output
)
{
void
BarrierDeltaStat
::
showAbstract
(
std
::
ostream
&
output
)
const
{
// do not support the case "<=2 pserver"
if
(
numConnThreads_
<=
2
||
!
totSamples_
)
{
return
;
...
...
paddle/utils/BarrierStat.h
浏览文件 @
6767d0fc
...
...
@@ -218,11 +218,12 @@ public:
}
protected:
virtual
void
showAbstract
(
std
::
ostream
&
output
)
{}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
output
,
BarrierStatBase
&
stat
);
virtual
void
showAbstract
(
std
::
ostream
&
output
)
const
{}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
output
,
const
BarrierStatBase
&
stat
);
protected:
std
::
mutex
lock_
;
mutable
std
::
mutex
lock_
;
std
::
mutex
abstractLock_
;
// see note on updaterStat
// each freqency for each barrier trainer
std
::
vector
<
struct
Abstract
>
abstract_
;
...
...
@@ -262,7 +263,7 @@ protected:
* log_barrier_abstract, log_barrier_lowest_nodes, log_barrier_threshold
* control details.
*/
virtual
void
showAbstract
(
std
::
ostream
&
output
);
virtual
void
showAbstract
(
std
::
ostream
&
output
)
const
;
private:
std
::
unique_ptr
<
TimeVectorEnd
>
timeVector_
;
...
...
@@ -286,7 +287,7 @@ public:
virtual
bool
checkPassBarrier
()
{
return
timeVector_
->
empty
();
}
protected:
virtual
void
showAbstract
(
std
::
ostream
&
outPut
);
virtual
void
showAbstract
(
std
::
ostream
&
outPut
)
const
;
private:
// store delta time in uint64_t, eg BP time of all trainers
...
...
paddle/utils/CompilerMacros.h
0 → 100644
浏览文件 @
6767d0fc
/* Copyright (c) 2016 Baidu, Inc. All Rights Reserve.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
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. */
#pragma once
#define ATTR_NORETURN __attribute__((noreturn))
paddle/utils/Logging.cpp
浏览文件 @
6767d0fc
...
...
@@ -134,7 +134,7 @@ static void initializeLogFds(char* argv0) {
gLogInited
=
true
;
}
static
void
(
*
gFailureFunctionPtr
)()
__attribute__
((
noreturn
))
=
abort
;
static
void
(
*
gFailureFunctionPtr
)()
ATTR_NORETURN
=
abort
;
LogMessage
::
LogMessage
(
const
char
*
fname
,
int
line
,
int
severity
)
:
fname_
(
fname
),
line_
(
line
),
severity_
(
severity
)
{}
...
...
@@ -171,7 +171,7 @@ void setMinLogLevel(int level) {
paddle
::
internal
::
gMinLogLevel
=
level
;
}
void
installFailureFunction
(
void
(
*
callback
)())
{
void
installFailureFunction
(
void
(
*
callback
)()
ATTR_NORETURN
)
{
paddle
::
internal
::
gFailureFunctionPtr
=
callback
;
}
...
...
paddle/utils/Logging.h
浏览文件 @
6767d0fc
...
...
@@ -23,6 +23,7 @@ limitations under the License. */
#include <string>
#ifndef PADDLE_USE_GLOG
#include "CompilerMacros.h"
//! TODO(yuyang18): Move this utility macro into some global header.
#define PP_CAT(a, b) PP_CAT_I(a, b)
...
...
@@ -168,7 +169,7 @@ void setMinLogLevel(int level);
* @brief Install Log(Fatal) failure function. Default is abort();
* @param callback: The failure function.
*/
void
installFailureFunction
(
void
(
*
callback
)());
void
installFailureFunction
(
void
(
*
callback
)()
ATTR_NORETURN
);
/**
* @brief installFailureWriter
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录