Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
8310c8f9
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8310c8f9
编写于
6月 21, 2019
作者:
S
superjomn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
init
上级
7cf536f0
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
26 addition
and
21 deletion
+26
-21
paddle/fluid/lite/api/cxx_api.cc
paddle/fluid/lite/api/cxx_api.cc
+19
-0
paddle/fluid/lite/api/cxx_api.h
paddle/fluid/lite/api/cxx_api.h
+2
-16
paddle/fluid/lite/utils/io.h
paddle/fluid/lite/utils/io.h
+5
-5
未找到文件。
paddle/fluid/lite/api/cxx_api.cc
浏览文件 @
8310c8f9
...
...
@@ -61,5 +61,24 @@ const framework::proto::ProgramDesc &Predictor::program_desc() const {
return
program_desc_
;
}
void
Predictor
::
Build
(
const
framework
::
proto
::
ProgramDesc
&
desc
,
const
Place
&
prefer_place
,
const
std
::
vector
<
Place
>
&
valid_places
)
{
program_desc_
=
desc
;
Program
program
(
desc
,
scope_
,
valid_places
);
optimizer_
.
KernelPickPreferPlace
(
prefer_place
);
core
::
KernelPickFactor
factor
;
factor
.
ConsiderTarget
();
factor
.
ConsiderPrecision
();
optimizer_
.
Run
(
std
::
move
(
program
),
valid_places
,
factor
);
program_
=
optimizer_
.
GenRuntimeProgram
();
}
const
lite
::
Tensor
*
Predictor
::
GetTensor
(
const
std
::
string
&
name
)
const
{
auto
*
var
=
program_
->
exec_scope
()
->
FindVar
(
name
);
return
&
var
->
Get
<
lite
::
Tensor
>
();
}
}
// namespace lite
}
// namespace paddle
paddle/fluid/lite/api/cxx_api.h
浏览文件 @
8310c8f9
...
...
@@ -42,18 +42,7 @@ class Predictor {
const
std
::
vector
<
Place
>&
valid_places
);
void
Build
(
const
framework
::
proto
::
ProgramDesc
&
desc
,
const
Place
&
prefer_place
,
const
std
::
vector
<
Place
>&
valid_places
)
{
program_desc_
=
desc
;
Program
program
(
desc
,
scope_
,
valid_places
);
optimizer_
.
KernelPickPreferPlace
(
prefer_place
);
core
::
KernelPickFactor
factor
;
factor
.
ConsiderTarget
();
factor
.
ConsiderPrecision
();
optimizer_
.
Run
(
std
::
move
(
program
),
valid_places
,
factor
);
program_
=
optimizer_
.
GenRuntimeProgram
();
}
const
Place
&
prefer_place
,
const
std
::
vector
<
Place
>&
valid_places
);
// Run the predictor for a single batch of data.
void
Run
()
{
program_
->
Run
();
}
...
...
@@ -66,10 +55,7 @@ class Predictor {
// Return the program desc for debug.
const
framework
::
proto
::
ProgramDesc
&
program_desc
()
const
;
const
lite
::
Tensor
*
GetTensor
(
const
std
::
string
&
name
)
const
{
auto
*
var
=
program_
->
exec_scope
()
->
FindVar
(
name
);
return
&
var
->
Get
<
lite
::
Tensor
>
();
}
const
lite
::
Tensor
*
GetTensor
(
const
std
::
string
&
name
)
const
;
// This method is disabled in mobile, for unnecessary dependencies required.
void
SaveModel
(
const
std
::
string
&
dir
);
...
...
paddle/fluid/lite/utils/io.h
浏览文件 @
8310c8f9
...
...
@@ -14,9 +14,7 @@
#pragma once
#ifndef LITE_WITH_ARM
#include <bits/stdc++.h>
#endif
#include <sys/stat.h>
#include <fstream>
#include <string>
#include "paddle/fluid/lite/utils/cp_logging.h"
...
...
@@ -35,12 +33,14 @@ static bool IsFileExists(const std::string& path) {
}
// ARM mobile not support mkdir in C++
#ifndef LITE_WITH_ARM
static
void
MkDirRecur
(
const
std
::
string
&
path
)
{
#ifndef LITE_WITH_ARM
CHECK_EQ
(
system
(
string_format
(
"mkdir -p %s"
,
path
.
c_str
()).
c_str
()),
0
)
<<
"Cann't mkdir "
<<
path
;
}
#else // On ARM
CHECK_NE
(
mkddir
(
path
.
c_str
(),
S_IRWXU
),
-
1
)
<<
"Cann't mkdir "
<<
path
;
#endif
}
}
// namespace lite
}
// namespace paddle
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录