Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
b54640bb
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看板
未验证
提交
b54640bb
编写于
1月 04, 2021
作者:
W
Wilber
提交者:
GitHub
1月 04, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Lite subgraph support lite_tensor_precision. (#30054)
上级
8925b1fa
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
9 addition
and
9 deletion
+9
-9
cmake/external/lite.cmake
cmake/external/lite.cmake
+1
-1
paddle/fluid/inference/analysis/ir_passes/lite_subgraph_pass.cc
.../fluid/inference/analysis/ir_passes/lite_subgraph_pass.cc
+2
-0
paddle/fluid/inference/lite/tensor_utils.cc
paddle/fluid/inference/lite/tensor_utils.cc
+6
-8
未找到文件。
cmake/external/lite.cmake
浏览文件 @
b54640bb
...
@@ -36,7 +36,7 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
...
@@ -36,7 +36,7 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR)
set
(
LITE_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/lite
)
set
(
LITE_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/lite
)
if
(
NOT LITE_GIT_TAG
)
if
(
NOT LITE_GIT_TAG
)
set
(
LITE_GIT_TAG
68e64e0eb74cdd13383ae78caf889973499ebd1
4
)
set
(
LITE_GIT_TAG
d3a3a6931b6d22d504d21ba32b3ae972770e920
4
)
endif
()
endif
()
if
(
NOT CUDA_ARCH_NAME
)
if
(
NOT CUDA_ARCH_NAME
)
...
...
paddle/fluid/inference/analysis/ir_passes/lite_subgraph_pass.cc
浏览文件 @
b54640bb
...
@@ -272,6 +272,8 @@ void LiteSubgraphPass::SetUpEngine(
...
@@ -272,6 +272,8 @@ void LiteSubgraphPass::SetUpEngine(
paddle
::
lite_api
::
Place
({
target_type
,
PRECISION
(
kInt64
)}),
paddle
::
lite_api
::
Place
({
target_type
,
PRECISION
(
kInt64
)}),
paddle
::
lite_api
::
Place
({
target_type
,
PRECISION
(
kFloat
)}),
paddle
::
lite_api
::
Place
({
target_type
,
PRECISION
(
kFloat
)}),
paddle
::
lite_api
::
Place
({
TARGET
(
kHost
),
PRECISION
(
kFloat
)}),
paddle
::
lite_api
::
Place
({
TARGET
(
kHost
),
PRECISION
(
kFloat
)}),
paddle
::
lite_api
::
Place
({
TARGET
(
kX86
),
precision_type
}),
paddle
::
lite_api
::
Place
({
TARGET
(
kX86
),
PRECISION
(
kFloat
)}),
};
};
config
.
cpu_math_library_num_threads
=
cpu_math_library_num_threads
;
config
.
cpu_math_library_num_threads
=
cpu_math_library_num_threads
;
config
.
xpu_l3_workspace_size
=
xpu_l3_workspace_size
;
config
.
xpu_l3_workspace_size
=
xpu_l3_workspace_size
;
...
...
paddle/fluid/inference/lite/tensor_utils.cc
浏览文件 @
b54640bb
...
@@ -185,10 +185,8 @@ void InitDstTensor(paddle::lite_api::Tensor* dst,
...
@@ -185,10 +185,8 @@ void InitDstTensor(paddle::lite_api::Tensor* dst,
void
InitDstTensor
(
framework
::
LoDTensor
*
dst
,
void
InitDstTensor
(
framework
::
LoDTensor
*
dst
,
const
paddle
::
lite_api
::
Tensor
&
src
)
{
const
paddle
::
lite_api
::
Tensor
&
src
)
{
constexpr
framework
::
proto
::
VarType
::
Type
dtype
=
framework
::
proto
::
VarType_Type_FP32
;
dst
->
mutable_data
(
inference
::
lite
::
utils
::
GetNativePlace
(
src
.
target
()),
dst
->
mutable_data
(
inference
::
lite
::
utils
::
GetNativePlace
(
src
.
target
()),
dtype
);
GetNativePrecisionType
(
src
.
precision
())
);
SetLoD
(
dst
->
mutable_lod
(),
src
.
lod
());
SetLoD
(
dst
->
mutable_lod
(),
src
.
lod
());
}
}
...
@@ -244,17 +242,17 @@ void TensorDataShare(paddle::lite_api::Tensor* dst, framework::LoDTensor* src) {
...
@@ -244,17 +242,17 @@ void TensorDataShare(paddle::lite_api::Tensor* dst, framework::LoDTensor* src) {
template
<
>
template
<
>
void
TensorDataShare
(
framework
::
LoDTensor
*
dst
,
paddle
::
lite_api
::
Tensor
*
src
)
{
void
TensorDataShare
(
framework
::
LoDTensor
*
dst
,
paddle
::
lite_api
::
Tensor
*
src
)
{
constexpr
framework
::
proto
::
VarType
::
Type
dtype
=
framework
::
proto
::
VarType_Type_FP32
;
void
*
src_raw_data
=
void
*
src_raw_data
=
GetLiteTensorDataPtr
(
src
,
GetLitePrecisionType
(
dtype
),
src
->
target
());
GetLiteTensorDataPtr
(
src
,
src
->
precision
(),
src
->
target
());
size_t
memory_size
=
GetLiteTensorNumel
(
*
src
)
*
sizeof
(
float
);
size_t
memory_size
=
GetLiteTensorNumel
(
*
src
)
*
framework
::
SizeOfType
(
GetNativePrecisionType
(
src
->
precision
()));
std
::
shared_ptr
<
memory
::
allocation
::
Allocation
>
holder
(
std
::
shared_ptr
<
memory
::
allocation
::
Allocation
>
holder
(
new
memory
::
allocation
::
Allocation
(
src_raw_data
,
memory_size
,
new
memory
::
allocation
::
Allocation
(
src_raw_data
,
memory_size
,
GetNativePlace
(
src
->
target
())));
GetNativePlace
(
src
->
target
())));
dst
->
Resize
(
paddle
::
framework
::
make_ddim
(
src
->
shape
()));
dst
->
Resize
(
paddle
::
framework
::
make_ddim
(
src
->
shape
()));
SetLoD
(
dst
->
mutable_lod
(),
src
->
lod
());
SetLoD
(
dst
->
mutable_lod
(),
src
->
lod
());
dst
->
ResetHolderWithType
(
holder
,
dtype
);
dst
->
ResetHolderWithType
(
holder
,
GetNativePrecisionType
(
src
->
precision
())
);
}
}
}
// namespace utils
}
// namespace utils
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录