Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
7b0cfd82
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7b0cfd82
编写于
7月 03, 2018
作者:
L
liuruilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
format files
上级
f8347e36
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
47 addition
and
54 deletion
+47
-54
src/framework/op_registry.h
src/framework/op_registry.h
+1
-1
src/io/executor.cpp
src/io/executor.cpp
+3
-2
src/io/paddle_mobile.cpp
src/io/paddle_mobile.cpp
+1
-1
src/io/paddle_mobile.h
src/io/paddle_mobile.h
+1
-0
src/ios_io/PaddleMobile.h
src/ios_io/PaddleMobile.h
+3
-3
src/ios_io/PaddleMobile.mm
src/ios_io/PaddleMobile.mm
+3
-3
src/operators/fetch_op.cpp
src/operators/fetch_op.cpp
+0
-2
src/operators/fetch_op.h
src/operators/fetch_op.h
+0
-1
src/operators/fusion_conv_add.cpp
src/operators/fusion_conv_add.cpp
+1
-2
src/operators/im2sequence_op.h
src/operators/im2sequence_op.h
+0
-1
src/operators/kernel/central-arm-func/batchnorm_arm_func.h
src/operators/kernel/central-arm-func/batchnorm_arm_func.h
+24
-26
src/operators/math/gemm.cpp
src/operators/math/gemm.cpp
+6
-7
src/operators/math/pool_2x2.cpp
src/operators/math/pool_2x2.cpp
+2
-2
src/operators/math/pooling.cpp
src/operators/math/pooling.cpp
+1
-1
src/operators/transpose_op.h
src/operators/transpose_op.h
+0
-1
test/common/test_openmp.cpp
test/common/test_openmp.cpp
+1
-1
未找到文件。
src/framework/op_registry.h
浏览文件 @
7b0cfd82
...
...
@@ -108,7 +108,7 @@ class OpRegistry {
__op_registrar_##op_type##_##device_name(#op_type); \
int TouchOpRegistrar_##op_type##_##device_name() { \
__op_registrar_##op_type##_##device_name.Touch(); \
printf(" registering !! \n"); \
printf(" registering !! \n");
\
return 0; \
}
...
...
src/io/executor.cpp
浏览文件 @
7b0cfd82
...
...
@@ -355,8 +355,9 @@ std::shared_ptr<framework::Tensor> Executor<Dtype, P>::Predict(
const
auto
&
pInfo
=
profile
[
i
];
uint64_t
timeCost
=
pInfo
.
runEnd
-
pInfo
.
runBegin
;
_tp
[
ops
[
i
]
->
Type
()]
+=
timeCost
;
// fprintf(pf, "%d\t%s\t%d\t%llu\t%llu\t%llu\n", i, ops[i]->Type().c_str(),
// pInfo.tid, pInfo.runBegin, pInfo.runEnd, timeCost);
// fprintf(pf, "%d\t%s\t%d\t%llu\t%llu\t%llu\n", i,
// ops[i]->Type().c_str(),
// pInfo.tid, pInfo.runBegin, pInfo.runEnd, timeCost);
}
// fclose(pf);
...
...
src/io/paddle_mobile.cpp
浏览文件 @
7b0cfd82
...
...
@@ -75,7 +75,7 @@ void PaddleMobile<Dtype, P>::Clear() {
}
template
<
typename
Dtype
,
Precision
P
>
PaddleMobile
<
Dtype
,
P
>::~
PaddleMobile
(){
PaddleMobile
<
Dtype
,
P
>::~
PaddleMobile
()
{
executor_
=
nullptr
;
loader_
=
nullptr
;
}
...
...
src/io/paddle_mobile.h
浏览文件 @
7b0cfd82
...
...
@@ -61,6 +61,7 @@ class PaddleMobile {
void
Clear
();
~
PaddleMobile
();
private:
std
::
shared_ptr
<
Loader
<
Dtype
,
P
>>
loader_
;
std
::
shared_ptr
<
Executor
<
Dtype
,
P
>>
executor_
;
...
...
src/ios_io/PaddleMobile.h
浏览文件 @
7b0cfd82
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
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.
...
...
src/ios_io/PaddleMobile.mm
浏览文件 @
7b0cfd82
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
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.
...
...
src/operators/fetch_op.cpp
浏览文件 @
7b0cfd82
...
...
@@ -29,5 +29,3 @@ REGISTER_OPERATOR_MALI_GPU(fetch, ops::FetchOp);
#endif
#ifdef PADDLE_MOBILE_FPGA
#endif
src/operators/fetch_op.h
浏览文件 @
7b0cfd82
...
...
@@ -44,7 +44,6 @@ class FetchOp : public framework::OperatorBase<DeviceType> {
FetchParam
param_
;
};
}
// namespace operators
}
// namespace paddle_mobile
...
...
src/operators/fusion_conv_add.cpp
浏览文件 @
7b0cfd82
...
...
@@ -48,8 +48,7 @@ void FusionConvAddOp<Dtype, T>::InferShape() const {
#ifdef PADDLE_MOBILE_CPU
#ifndef CONV_ADD_REGISTER
framework
::
FusionOpRegistrar
convadd_registrar
(
new
FusionConvAddMatcher
());
framework
::
FusionOpRegistrar
convadd_registrar
(
new
FusionConvAddMatcher
());
#define CONV_ADD_REGISTER
#endif
...
...
src/operators/im2sequence_op.h
浏览文件 @
7b0cfd82
...
...
@@ -59,4 +59,3 @@ USE_OP_CPU(im2sequence);
#endif
#endif
src/operators/kernel/central-arm-func/batchnorm_arm_func.h
浏览文件 @
7b0cfd82
...
...
@@ -231,37 +231,35 @@ void BatchnormCompute(const BatchNormParam ¶m) {
}
#endif
float
*
inv_std_ptr
=
new
float
[
C
];
for
(
int
i
=
0
;
i
<
C
;
i
++
)
{
inv_std_ptr
[
i
]
=
1
/
static_cast
<
float
>
(
pow
((
variance_ptr
[
i
]
+
epsilon
),
0.5
));
}
Tensor
new_scale
;
auto
new_scale_ptr
=
new_scale
.
mutable_data
<
float
>
(
framework
::
make_ddim
({
C
}));
Tensor
new_bias
;
auto
new_bias_ptr
=
new_bias
.
mutable_data
<
float
>
(
framework
::
make_ddim
({
C
}));
for
(
int
i
=
0
;
i
<
C
;
i
++
)
{
inv_std_ptr
[
i
]
=
1
/
static_cast
<
float
>
(
pow
((
variance_ptr
[
i
]
+
epsilon
),
0.5
));
}
/// ((x - est_mean) * (inv_var) * scale + bias equal to
/// (x * inv_var * scale) + (bias - est_mean * inv_var * scale)
for
(
int
i
=
0
;
i
<
C
;
i
++
)
{
new_scale_ptr
[
i
]
=
inv_std_ptr
[
i
]
*
scale_ptr
[
i
];
new_bias_ptr
[
i
]
=
bias_ptr
[
i
]
-
mean_ptr
[
i
]
*
inv_std_ptr
[
i
]
*
scale_ptr
[
i
];
{
for
(
int
n
=
0
;
n
<
N
;
n
++
)
{
for
(
int
h
=
0
;
h
<
H
;
h
++
)
{
int
tmp_index
=
n
*
stride0
+
i
*
stride1
+
h
*
stride2
;
for
(
int
w
=
0
;
w
<
W
;
w
++
)
{
int
index
=
tmp_index
+
w
;
out_ptr
[
index
]
=
input_x_ptr
[
index
]
*
new_scale_ptr
[
i
]
+
new_bias_ptr
[
i
];
}
Tensor
new_scale
;
auto
new_scale_ptr
=
new_scale
.
mutable_data
<
float
>
(
framework
::
make_ddim
({
C
}));
Tensor
new_bias
;
auto
new_bias_ptr
=
new_bias
.
mutable_data
<
float
>
(
framework
::
make_ddim
({
C
}));
/// ((x - est_mean) * (inv_var) * scale + bias equal to
/// (x * inv_var * scale) + (bias - est_mean * inv_var * scale)
for
(
int
i
=
0
;
i
<
C
;
i
++
)
{
new_scale_ptr
[
i
]
=
inv_std_ptr
[
i
]
*
scale_ptr
[
i
];
new_bias_ptr
[
i
]
=
bias_ptr
[
i
]
-
mean_ptr
[
i
]
*
inv_std_ptr
[
i
]
*
scale_ptr
[
i
];
{
for
(
int
n
=
0
;
n
<
N
;
n
++
)
{
for
(
int
h
=
0
;
h
<
H
;
h
++
)
{
int
tmp_index
=
n
*
stride0
+
i
*
stride1
+
h
*
stride2
;
for
(
int
w
=
0
;
w
<
W
;
w
++
)
{
int
index
=
tmp_index
+
w
;
out_ptr
[
index
]
=
input_x_ptr
[
index
]
*
new_scale_ptr
[
i
]
+
new_bias_ptr
[
i
];
}
}
}
}
delete
[]
inv_std_ptr
;
}
delete
[]
inv_std_ptr
;
}
}
// namespace operators
...
...
src/operators/math/gemm.cpp
浏览文件 @
7b0cfd82
...
...
@@ -129,14 +129,13 @@ void PackMatrixB_(int k, int n, int n_tail, const float *B, int ldb,
}
#else
for
(
i
=
0
;
i
<
k
;
++
i
)
{
Bij
=
&
B
(
i
,
j
);
*
buffer
++
=
*
Bij
;
*
buffer
++
=
*
(
Bij
+
1
);
*
buffer
++
=
*
(
Bij
+
2
);
*
buffer
++
=
*
(
Bij
+
3
);
}
Bij
=
&
B
(
i
,
j
);
*
buffer
++
=
*
Bij
;
*
buffer
++
=
*
(
Bij
+
1
);
*
buffer
++
=
*
(
Bij
+
2
);
*
buffer
++
=
*
(
Bij
+
3
);
}
#endif
}
if
(
n_tail
!=
0
)
{
for
(
i
=
0
;
i
<
k
;
++
i
)
{
...
...
src/operators/math/pool_2x2.cpp
浏览文件 @
7b0cfd82
...
...
@@ -102,7 +102,7 @@ void Pool2x2Avg(vector<int> strides, vector<int> paddings, const Tensor *input,
#if __ARM_NEON
#ifdef ARMV7
const
int
batch_size
=
input
->
dims
()[
0
];
const
int
batch_size
=
input
->
dims
()[
0
];
const
int
input_height
=
input
->
dims
()[
2
];
...
...
@@ -173,7 +173,7 @@ const int batch_size = input->dims()[0];
}
#else
//
TODO(): to imp other asm
//
TODO(): to imp other asm
#endif
...
...
src/operators/math/pooling.cpp
浏览文件 @
7b0cfd82
...
...
@@ -57,7 +57,7 @@ class PoolFunctor<CPU, PoolProcess, T> {
T
*
output_data
=
output
->
mutable_data
<
T
>
();
for
(
int
i
=
0
;
i
<
batch_size
;
i
++
)
{
#pragma omp parallel for
// <TRICKY-CLANG-FORMAT-PRAGMA-FIX>
#pragma omp parallel for
for
(
int
c
=
0
;
c
<
output_channels
;
++
c
)
{
for
(
int
ph
=
0
;
ph
<
output_height
;
++
ph
)
{
int
hstart
=
ph
*
stride_height
-
padding_height
;
...
...
src/operators/transpose_op.h
浏览文件 @
7b0cfd82
...
...
@@ -50,7 +50,6 @@ class TransposeOp : public framework::OperatorWithKernel<
}
// namespace operators
}
// namespace paddle_mobile
#ifdef PADDLE_MOBILE_CPU
USE_OP_CPU
(
transpose
);
#endif
...
...
test/common/test_openmp.cpp
浏览文件 @
7b0cfd82
...
...
@@ -17,7 +17,7 @@ limitations under the License. */
int
main
(
void
)
{
#ifdef PADDLE_MOBILE_USE_OPENMP
#pragma omp parallel num_threads(2)
// <TRICKY-CLANG-FORMAT-PRAGMA-FIX>
#pragma omp parallel num_threads(2)
{
// int thread_id = omp_get_thread_num();
// int nthreads = omp_get_num_threads();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录