Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
f110700d
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看板
未验证
提交
f110700d
编写于
7月 30, 2018
作者:
Z
zhangyang0701
提交者:
GitHub
7月 30, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into develop
上级
19fb501b
40ee1a31
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
83 addition
and
12 deletion
+83
-12
src/common/types.h
src/common/types.h
+7
-1
src/framework/program/program-optimize/fusion_op_register.h
src/framework/program/program-optimize/fusion_op_register.h
+3
-1
src/framework/tensor.h
src/framework/tensor.h
+5
-3
src/io/executor.cpp
src/io/executor.cpp
+2
-2
src/operators/concat_op.cpp
src/operators/concat_op.cpp
+4
-1
src/operators/concat_op.h
src/operators/concat_op.h
+1
-0
src/operators/kernel/fpga/concat_kernel.cpp
src/operators/kernel/fpga/concat_kernel.cpp
+55
-0
tools/android-cmake/android.toolchain.cmake
tools/android-cmake/android.toolchain.cmake
+2
-0
tools/build.sh
tools/build.sh
+4
-4
未找到文件。
src/common/types.h
浏览文件 @
f110700d
...
...
@@ -20,7 +20,9 @@ limitations under the License. */
#include <vector>
namespace
paddle_mobile
{
enum
class
Precision
:
int
{
FP32
=
0
};
enum
class
Precision
:
int
{
FP32
=
0
,
FP16
=
1
};
typedef
int16_t
half
;
template
<
Precision
p
>
struct
PrecisionTrait
{
...
...
@@ -31,6 +33,10 @@ template <>
struct
PrecisionTrait
<
Precision
::
FP32
>
{
typedef
float
ptype
;
};
template
<
>
struct
PrecisionTrait
<
Precision
::
FP16
>
{
typedef
half
ptype
;
};
//! device type
enum
DeviceTypeEnum
{
kINVALID
=
-
1
,
kCPU
=
0
,
kFPGA
=
1
,
kGPU_MALI
=
2
};
...
...
src/framework/program/program-optimize/fusion_op_register.h
浏览文件 @
f110700d
...
...
@@ -14,11 +14,13 @@ limitations under the License. */
#pragma once
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include "framework/operator.h"
#include "node.h"
#include "
framework/program/program-optimize/
node.h"
namespace
paddle_mobile
{
namespace
framework
{
...
...
src/framework/tensor.h
浏览文件 @
f110700d
...
...
@@ -16,14 +16,15 @@ limitations under the License. */
#include <cstdint>
#include <cstring>
#include <fstream>
#include <memory>
#include <string>
#include <type_traits>
#include <typeindex>
#include <vector>
#include "common/enforce.h"
#include <fstream>
#include "common/enforce.h"
#include "common/types.h"
#include "framework/data_layout.h"
#include "framework/ddim.h"
#include "memory/t_malloc.h"
...
...
@@ -63,7 +64,8 @@ struct SizeOfTypeFunctor<HEAD, TAIL...> {
};
static
inline
size_t
SizeOfType
(
std
::
type_index
type
)
{
SizeOfTypeFunctor
<
int
,
float
,
double
,
int16_t
,
int64_t
,
bool
,
size_t
>
functor
;
SizeOfTypeFunctor
<
int
,
half
,
float
,
double
,
int16_t
,
int64_t
,
bool
,
size_t
>
functor
;
size_t
size
=
functor
(
type
);
PADDLE_MOBILE_ENFORCE
(
size
!=
0UL
,
"Cannot get size of type %s"
,
type
.
name
());
...
...
src/io/executor.cpp
浏览文件 @
f110700d
...
...
@@ -187,7 +187,7 @@ void Executor<Dtype, P>::LoadMemory(const framework::VarDesc var_desc,
memcpy
(
&
max_value
,
*
data
+
sizeof
(
float
),
sizeof
(
float
));
*
data
+=
2
*
sizeof
(
float
);
const
float
factor
=
(
max_value
-
min_value
)
/
255.0
;
uint8_t
*
uint8_data
=
(
uint8_t
*
)
(
*
data
);
uint8_t
*
uint8_data
=
reinterpret_cast
<
uint8_t
*>
(
*
data
);
for
(
int
k
=
0
;
k
<
memory_size
;
++
k
)
{
static_cast
<
float
*>
(
memory
)[
k
]
=
uint8_data
[
k
]
*
factor
+
min_value
;
}
...
...
@@ -420,6 +420,6 @@ std::vector<typename Executor<Dtype, P>::Ptype> Executor<Dtype, P>::Predict(
template
class
Executor
<
CPU
,
Precision
::
FP32
>;
template
class
Executor
<
FPGA
,
Precision
::
FP32
>;
template
class
Executor
<
GPU_MALI
,
Precision
::
FP
32
>;
template
class
Executor
<
GPU_MALI
,
Precision
::
FP
16
>;
}
// namespace paddle_mobile
src/operators/concat_op.cpp
浏览文件 @
f110700d
...
...
@@ -14,7 +14,9 @@ limitations under the License. */
#ifdef CONCAT_OP
#include "concat_op.h"
#include <vector>
#include "operators/concat_op.h"
namespace
paddle_mobile
{
namespace
operators
{
...
...
@@ -68,6 +70,7 @@ REGISTER_OPERATOR_CPU(concat, ops::ConcatOp);
REGISTER_OPERATOR_MALI_GPU
(
concat
,
ops
::
ConcatOp
);
#endif
#ifdef PADDLE_MOBILE_FPGA
REGISTER_OPERATOR_FPGA
(
concat
,
ops
::
ConcatOp
);
#endif
#endif
src/operators/concat_op.h
浏览文件 @
f110700d
...
...
@@ -53,6 +53,7 @@ USE_OP_CPU(concat);
USE_OP_MALI_GPU
(
concat
);
#endif
#ifdef PADDLE_MOBILE_FPGA
USE_OP_FPGA
(
concat
);
#endif
#endif
src/operators/kernel/fpga/concat_kernel.cpp
0 → 100644
浏览文件 @
f110700d
/* 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.
See the License for the specific language governing permissions and
limitations under the License. */
#ifdef CONCAT_OP
#include "operators/kernel/concat_kernel.h"
namespace
paddle_mobile
{
namespace
operators
{
template
<
>
bool
ConcatKernel
<
FPGA
,
half
>::
Init
(
ConcatParam
*
param
)
{
return
true
;
}
template
<
>
void
ConcatKernel
<
FPGA
,
half
>::
Compute
(
const
ConcatParam
&
param
)
const
{
auto
inputs
=
param
.
Inputs
();
auto
*
out
=
param
.
Out
();
int64_t
axis
=
param
.
Axis
();
out
->
mutable_data
<
half
>
();
DDim
out_dim
=
out
->
dims
();
int
pixels
=
out_dim
[
1
]
*
out_dim
[
2
];
auto
out_channel
=
out_dim
[
3
];
auto
out_offset
=
0
;
for
(
int
i
=
0
;
i
<
inputs
.
size
();
++
i
)
{
auto
input
=
inputs
[
i
];
auto
channels
=
input
[
3
];
out_offset
+=
channels
;
auto
src
=
input
->
data
<
half
>
();
for
(
int
j
=
0
;
j
<
pixels
;
++
j
)
{
auto
dst
=
out
->
data
<
half
>
()
+
out_offset
;
memory
::
Copy
(
dst
,
src
,
sizeof
(
half
));
}
}
}
}
// namespace operators
}
// namespace paddle_mobile
#endif
tools/android-cmake/android.toolchain.cmake
浏览文件 @
f110700d
...
...
@@ -65,6 +65,8 @@ endif()
file
(
TO_CMAKE_PATH
"
${
ANDROID_NDK
}
"
ANDROID_NDK
)
# Android NDK revision
message
(
"
${
ANDROID_NDK
}
"
)
file
(
READ
"
${
ANDROID_NDK
}
/source.properties"
ANDROID_NDK_SOURCE_PROPERTIES
)
set
(
ANDROID_NDK_SOURCE_PROPERTIES_REGEX
"^Pkg
\\
.Desc = Android NDK
\n
Pkg
\\
.Revision = ([0-9]+)
\\
."
)
...
...
tools/build.sh
浏览文件 @
f110700d
...
...
@@ -40,8 +40,8 @@ build_for_android() {
fi
if
[
-z
"
$PLATFORM
"
]
;
then
PLATFORM
=
"arm-v7a"
# Users could choose "arm-v8a" platform.
#
PLATFORM="arm-v8a"
#
PLATFORM="arm-v7a" # Users could choose "arm-v8a" platform.
PLATFORM
=
"arm-v8a"
fi
if
[
"
${
PLATFORM
}
"
=
"arm-v7a"
]
;
then
...
...
@@ -63,7 +63,7 @@ build_for_android() {
TOOLCHAIN_FILE
=
"./tools/android-cmake/android.toolchain.cmake"
ANDROID_ARM_MODE
=
"arm"
if
[
"
${#
NETS
}
"
>
1
]
;
then
if
[
"
${#
NETS
}
"
-gt
1
]
;
then
cmake ..
\
-B
"../build/release/
${
PLATFORM
}
"
\
-DANDROID_ABI
=
"
${
ABI
}
"
\
...
...
@@ -99,7 +99,7 @@ build_for_ios() {
BUILD_DIR
=
../build/release/
"
${
PLATFORM
}
"
/
TOOLCHAIN_FILE
=
"./tools/ios-cmake/ios.toolchain.cmake"
mkdir
-p
"
${
BUILD_DIR
}
"
if
[
"
${#
NETS
}
"
>
1
]
;
then
if
[
"
${#
NETS
}
"
-gt
1
]
;
then
cmake ..
\
-B
"
${
BUILD_DIR
}
"
\
-DCMAKE_BUILD_TYPE
=
"
${
MODE
}
"
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录