Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
741f9243
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
332
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看板
提交
741f9243
编写于
9月 17, 2019
作者:
S
sangoly
提交者:
Yan Chunwei
9月 17, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[cherry-pick] cherry-pick develop(#2047) to release/v2.0.0-beta2 test=develop (#2054)
上级
908fa796
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
94 addition
and
0 deletion
+94
-0
lite/api/cxx_api_impl.cc
lite/api/cxx_api_impl.cc
+6
-0
lite/api/light_api_impl.cc
lite/api/light_api_impl.cc
+6
-0
lite/api/paddle_api.h
lite/api/paddle_api.h
+2
-0
lite/api/paddle_api_test.cc
lite/api/paddle_api_test.cc
+4
-0
lite/core/CMakeLists.txt
lite/core/CMakeLists.txt
+27
-0
lite/core/version.h.in
lite/core/version.h.in
+49
-0
未找到文件。
lite/api/cxx_api_impl.cc
浏览文件 @
741f9243
...
...
@@ -13,7 +13,9 @@
// limitations under the License.
#include "lite/api/cxx_api.h"
#include <string>
#include "lite/api/paddle_api.h"
#include "lite/core/version.h"
namespace
paddle
{
namespace
lite
{
...
...
@@ -31,6 +33,8 @@ class CxxPaddleApiImpl : public lite_api::PaddlePredictor {
void
Run
()
override
;
std
::
string
GetVersion
()
const
override
;
std
::
unique_ptr
<
const
lite_api
::
Tensor
>
GetTensor
(
const
std
::
string
&
name
)
const
override
;
...
...
@@ -63,6 +67,8 @@ std::unique_ptr<const lite_api::Tensor> CxxPaddleApiImpl::GetOutput(
void
CxxPaddleApiImpl
::
Run
()
{
raw_predictor_
.
Run
();
}
std
::
string
CxxPaddleApiImpl
::
GetVersion
()
const
{
return
version
();
}
std
::
unique_ptr
<
const
lite_api
::
Tensor
>
CxxPaddleApiImpl
::
GetTensor
(
const
std
::
string
&
name
)
const
{
auto
*
x
=
raw_predictor_
.
GetTensor
(
name
);
...
...
lite/api/light_api_impl.cc
浏览文件 @
741f9243
...
...
@@ -13,7 +13,9 @@
// limitations under the License.
#include "lite/api/light_api.h"
#include <string>
#include "lite/api/paddle_api.h"
#include "lite/core/version.h"
#include "lite/model_parser/model_parser.h"
namespace
paddle
{
...
...
@@ -29,6 +31,8 @@ class LightPredictorImpl : public PaddlePredictor {
void
Run
()
override
;
std
::
string
GetVersion
()
const
override
;
std
::
unique_ptr
<
const
Tensor
>
GetTensor
(
const
std
::
string
&
name
)
const
override
;
...
...
@@ -61,6 +65,8 @@ std::unique_ptr<const Tensor> LightPredictorImpl::GetOutput(int i) const {
void
LightPredictorImpl
::
Run
()
{
raw_predictor_
->
Run
();
}
std
::
string
LightPredictorImpl
::
GetVersion
()
const
{
return
lite
::
version
();
}
std
::
unique_ptr
<
const
Tensor
>
LightPredictorImpl
::
GetTensor
(
const
std
::
string
&
name
)
const
{
return
std
::
unique_ptr
<
const
Tensor
>
(
...
...
lite/api/paddle_api.h
浏览文件 @
741f9243
...
...
@@ -72,6 +72,8 @@ class LITE_API PaddlePredictor {
virtual
void
Run
()
=
0
;
virtual
std
::
string
GetVersion
()
const
=
0
;
/// Get a readonly tensor, return null if no one called `name` exists.
virtual
std
::
unique_ptr
<
const
Tensor
>
GetTensor
(
const
std
::
string
&
name
)
const
=
0
;
...
...
lite/api/paddle_api_test.cc
浏览文件 @
741f9243
...
...
@@ -36,6 +36,8 @@ TEST(CxxApi, run) {
auto
predictor
=
lite_api
::
CreatePaddlePredictor
(
config
);
LOG
(
INFO
)
<<
"Version: "
<<
predictor
->
GetVersion
();
auto
input_tensor
=
predictor
->
GetInput
(
0
);
input_tensor
->
Resize
(
std
::
vector
<
int64_t
>
({
100
,
100
}));
auto
*
data
=
input_tensor
->
mutable_data
<
float
>
();
...
...
@@ -66,6 +68,8 @@ TEST(LightApi, run) {
auto
predictor
=
lite_api
::
CreatePaddlePredictor
(
config
);
LOG
(
INFO
)
<<
"Version: "
<<
predictor
->
GetVersion
();
auto
input_tensor
=
predictor
->
GetInput
(
0
);
input_tensor
->
Resize
(
std
::
vector
<
int64_t
>
({
100
,
100
}));
auto
*
data
=
input_tensor
->
mutable_data
<
float
>
();
...
...
lite/core/CMakeLists.txt
浏览文件 @
741f9243
...
...
@@ -38,6 +38,33 @@ else()
lite_cc_library
(
context SRCS context.cc DEPS tensor any device_info eigen3 CL_DEPS cl_context gflags
)
endif
()
#-------------------------------------------- GET CODE META INFO ------------------------------------------
execute_process
(
COMMAND git describe --tags --exact-match
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
OUTPUT_VARIABLE PADDLE_LITE_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process
(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
OUTPUT_VARIABLE PADDLE_LITE_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process
(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
OUTPUT_VARIABLE PADDLE_LITE_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message
(
STATUS
"tag:
${
PADDLE_LITE_TAG
}
"
)
message
(
STATUS
"branch:
${
PADDLE_LITE_BRANCH
}
"
)
message
(
STATUS
"commit:
${
PADDLE_LITE_COMMIT
}
"
)
configure_file
(
version.h.in version.h
)
#----------------------------------------------- NOT CHANGE -----------------------------------------------
# A trick to generate the paddle_use_kernels.h
add_custom_command
(
...
...
lite/core/version.h.in
0 → 100644
浏览文件 @
741f9243
// Copyright (c) 2019 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.
#pragma once
#include <string>
#include "lite/utils/replace_stl/stream.h"
namespace paddle {
namespace lite {
static std::string paddlelite_commit() {
return "@PADDLE_LITE_COMMIT@";
}
static std::string paddlelite_branch() {
return "@PADDLE_LITE_BRANCH@";
}
static std::string paddlelite_tag() {
return "@PADDLE_LITE_TAG@";
}
static std::string version() {
STL::stringstream ss;
std::string tag = paddlelite_tag();
if (tag.empty()) {
ss << paddlelite_branch() << "(" << paddlelite_commit() << ")";
} else {
ss << tag;
}
return ss.str();
}
} // namespace lite
} // namespace paddle
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录