Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
2e2726f1
P
Paddle
项目概览
Crayon鑫
/
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看板
提交
2e2726f1
编写于
4月 08, 2018
作者:
A
Abhinav Arora
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix cpplint issues in some operators
上级
817df54b
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
35 addition
and
21 deletion
+35
-21
paddle/fluid/operators/activation_mkldnn_op.cc
paddle/fluid/operators/activation_mkldnn_op.cc
+9
-6
paddle/fluid/operators/activation_op.h
paddle/fluid/operators/activation_op.h
+2
-0
paddle/fluid/operators/adagrad_op.cc
paddle/fluid/operators/adagrad_op.cc
+1
-0
paddle/fluid/operators/array_operator.h
paddle/fluid/operators/array_operator.h
+1
-0
paddle/fluid/operators/assign_value_op.cc
paddle/fluid/operators/assign_value_op.cc
+2
-0
paddle/fluid/operators/assign_value_op.h
paddle/fluid/operators/assign_value_op.h
+1
-0
paddle/fluid/operators/auc_op.cc
paddle/fluid/operators/auc_op.cc
+1
-0
paddle/fluid/operators/auc_op.h
paddle/fluid/operators/auc_op.h
+9
-6
paddle/fluid/operators/average_accumulates_op.cc
paddle/fluid/operators/average_accumulates_op.cc
+5
-5
paddle/fluid/operators/average_accumulates_op.h
paddle/fluid/operators/average_accumulates_op.h
+4
-4
未找到文件。
paddle/fluid/operators/activation_mkldnn_op.cc
浏览文件 @
2e2726f1
...
...
@@ -13,8 +13,8 @@
limitations under the License. */
#include "mkldnn.hpp"
#include "mkldnn_activation_op.h"
#include "paddle/fluid/operators/activation_op.h"
#include "paddle/fluid/operators/mkldnn_activation_op.h"
namespace
paddle
{
namespace
operators
{
...
...
@@ -50,8 +50,10 @@ void eltwise_forward(const ExecContext &ctx, mkldnn::algorithm algorithm,
mkldnn
::
memory
::
format
::
nchw
);
// create memory primitives
auto
src_memory
=
mkldnn
::
memory
({
data_md
,
mkldnn_engine
},
(
void
*
)
src_data
);
auto
dst_memory
=
mkldnn
::
memory
({
data_md
,
mkldnn_engine
},
(
void
*
)
dst_data
);
auto
src_memory
=
mkldnn
::
memory
({
data_md
,
mkldnn_engine
},
static_cast
<
void
*>
(
src_data
));
auto
dst_memory
=
mkldnn
::
memory
({
data_md
,
mkldnn_engine
},
static_cast
<
void
*>
(
dst_data
));
auto
forward_desc
=
mkldnn
::
eltwise_forward
::
desc
(
mkldnn
::
prop_kind
::
forward_training
,
algorithm
,
data_md
,
alpha
,
beta
);
...
...
@@ -95,11 +97,12 @@ void eltwise_grad(const ExecContext &ctx, mkldnn::algorithm algorithm,
mkldnn
::
memory
::
format
::
nchw
);
// create memory primitives
auto
src_memory
=
mkldnn
::
memory
({
data_md
,
mkldnn_engine
},
(
void
*
)
src
);
auto
src_memory
=
mkldnn
::
memory
({
data_md
,
mkldnn_engine
},
static_cast
<
void
*>
(
src
));
auto
diff_src_memory
=
mkldnn
::
memory
({
data_md
,
mkldnn_engine
},
(
void
*
)
diff_src
);
mkldnn
::
memory
({
data_md
,
mkldnn_engine
},
static_cast
<
void
*>
(
diff_src
)
);
auto
diff_dst_memory
=
mkldnn
::
memory
({
data_md
,
mkldnn_engine
},
(
void
*
)
diff_dst
);
mkldnn
::
memory
({
data_md
,
mkldnn_engine
},
static_cast
<
void
*>
(
diff_dst
)
);
auto
backward_desc
=
mkldnn
::
eltwise_backward
::
desc
(
algorithm
,
data_md
,
data_md
,
alpha
,
beta
);
...
...
paddle/fluid/operators/activation_op.h
浏览文件 @
2e2726f1
...
...
@@ -13,6 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
#include <utility>
#include <vector>
#include "paddle/fluid/framework/eigen.h"
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/operators/detail/safe_ref.h"
...
...
paddle/fluid/operators/adagrad_op.cc
浏览文件 @
2e2726f1
...
...
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/fluid/operators/adagrad_op.h"
#include <vector>
#include <cmath>
...
...
paddle/fluid/operators/array_operator.h
浏览文件 @
2e2726f1
...
...
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
#include <string>
#include "paddle/fluid/framework/lod_tensor_array.h"
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/platform/device_context.h"
...
...
paddle/fluid/operators/assign_value_op.cc
浏览文件 @
2e2726f1
...
...
@@ -13,6 +13,8 @@
// limitations under the License.
#include "paddle/fluid/operators/assign_value_op.h"
#include <string>
#include <vector>
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/assign_value_op.h
浏览文件 @
2e2726f1
...
...
@@ -14,6 +14,7 @@
#pragma once
#include <vector>
#include "paddle/fluid/framework/eigen.h"
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/platform/enforce.h"
...
...
paddle/fluid/operators/auc_op.cc
浏览文件 @
2e2726f1
...
...
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include "paddle/fluid/operators/auc_op.h"
#include <string>
namespace
paddle
{
namespace
operators
{
...
...
paddle/fluid/operators/auc_op.h
浏览文件 @
2e2726f1
...
...
@@ -13,6 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License. */
#pragma once
#include <string>
#include <vector>
#include "paddle/fluid/framework/eigen.h"
#include "paddle/fluid/framework/op_registry.h"
...
...
@@ -40,7 +42,7 @@ class AucKernel : public framework::OpKernel<T> {
std
::
vector
<
float
>
thresholds_list
;
thresholds_list
.
reserve
(
num_thresholds
);
for
(
int
i
=
1
;
i
<
num_thresholds
-
1
;
i
++
)
{
thresholds_list
[
i
]
=
(
float
)
i
/
(
num_thresholds
-
1
);
thresholds_list
[
i
]
=
static_cast
<
float
>
(
i
)
/
(
num_thresholds
-
1
);
}
const
float
kEpsilon
=
1e-7
;
thresholds_list
[
0
]
=
0.0
f
-
kEpsilon
;
...
...
@@ -105,11 +107,12 @@ class AucKernel : public framework::OpKernel<T> {
float
*
fp_rate_data
=
fp_rate
.
mutable_data
<
float
>
(
ctx
.
GetPlace
());
float
*
rec_rate_data
=
rec_rate
.
mutable_data
<
float
>
(
ctx
.
GetPlace
());
for
(
int
i
=
0
;
i
<
num_thresholds
;
i
++
)
{
tp_rate_data
[
i
]
=
((
float
)
tp_data
[
i
]
+
epsilon
)
/
(
tp_data
[
i
]
+
fn_data
[
i
]
+
epsilon
);
fp_rate_data
[
i
]
=
(
float
)
fp_data
[
i
]
/
(
fp_data
[
i
]
+
tn_data
[
i
]
+
epsilon
);
rec_rate_data
[
i
]
=
((
float
)
tp_data
[
i
]
+
epsilon
)
/
(
tp_data
[
i
]
+
fp_data
[
i
]
+
epsilon
);
tp_rate_data
[
i
]
=
(
static_cast
<
float
>
(
tp_data
[
i
])
+
epsilon
)
/
(
tp_data
[
i
]
+
fn_data
[
i
]
+
epsilon
);
fp_rate_data
[
i
]
=
static_cast
<
float
>
(
fp_data
[
i
])
/
(
fp_data
[
i
]
+
tn_data
[
i
]
+
epsilon
);
rec_rate_data
[
i
]
=
(
static_cast
<
float
>
(
tp_data
[
i
])
+
epsilon
)
/
(
tp_data
[
i
]
+
fp_data
[
i
]
+
epsilon
);
}
*
auc_data
=
0.0
f
;
if
(
curve
==
"ROC"
)
{
...
...
paddle/fluid/operators/average_accumulates_op.cc
浏览文件 @
2e2726f1
...
...
@@ -19,15 +19,15 @@ namespace operators {
template
<
>
void
GetAccumulators
<
paddle
::
platform
::
CPUDeviceContext
>
(
const
framework
::
ExecutionContext
&
ctx
,
int64_t
&
num_updates_
,
int64_t
&
num_accumulates_
,
int64_t
&
old_num_accumulates_
)
{
const
framework
::
ExecutionContext
&
ctx
,
int64_t
*
num_updates_
,
int64_t
*
num_accumulates_
,
int64_t
*
old_num_accumulates_
)
{
auto
*
in_old_num_accumulates
=
ctx
.
Input
<
Tensor
>
(
"in_old_num_accumulates"
);
auto
*
in_num_accumulates
=
ctx
.
Input
<
Tensor
>
(
"in_num_accumulates"
);
auto
*
in_num_updates
=
ctx
.
Input
<
Tensor
>
(
"in_num_updates"
);
old_num_accumulates_
=
in_old_num_accumulates
->
data
<
int64_t
>
()[
0
];
num_accumulates_
=
in_num_accumulates
->
data
<
int64_t
>
()[
0
];
num_updates_
=
in_num_updates
->
data
<
int64_t
>
()[
0
];
*
old_num_accumulates_
=
in_old_num_accumulates
->
data
<
int64_t
>
()[
0
];
*
num_accumulates_
=
in_num_accumulates
->
data
<
int64_t
>
()[
0
];
*
num_updates_
=
in_num_updates
->
data
<
int64_t
>
()[
0
];
}
template
<
>
...
...
paddle/fluid/operators/average_accumulates_op.h
浏览文件 @
2e2726f1
...
...
@@ -29,8 +29,8 @@ using EigenVector = framework::EigenVector<T, MajorType, IndexType>;
template
<
typename
DeviceContext
>
void
GetAccumulators
(
const
framework
::
ExecutionContext
&
ctx
,
int64_t
&
num_updates
,
int64_t
&
num_accumulates
,
int64_t
&
old_num_accumulates
);
int64_t
*
num_updates
,
int64_t
*
num_accumulates
,
int64_t
*
old_num_accumulates
);
template
<
typename
DeviceContext
>
void
SetAccumulators
(
const
framework
::
ExecutionContext
&
ctx
,
...
...
@@ -47,8 +47,8 @@ class AverageAccumulatesKernel : public framework::OpKernel<T> {
int64_t
num_updates
=
0
;
int64_t
num_accumulates
=
0
;
int64_t
old_num_accumulates
=
0
;
GetAccumulators
<
DeviceContext
>
(
ctx
,
num_updates
,
num_accumulates
,
old_num_accumulates
);
GetAccumulators
<
DeviceContext
>
(
ctx
,
&
num_updates
,
&
num_accumulates
,
&
old_num_accumulates
);
// Get attrs
float
average_window
=
ctx
.
Attr
<
float
>
(
"average_window"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录