Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
851b20ce
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看板
未验证
提交
851b20ce
编写于
10月 31, 2018
作者:
R
Ray Liu
提交者:
GitHub
10月 31, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1234 from yangfei963158659/develop
modify operator.cpp
上级
1c6b2777
077f5f88
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
71 addition
and
55 deletion
+71
-55
src/framework/operator.cpp
src/framework/operator.cpp
+71
-55
未找到文件。
src/framework/operator.cpp
浏览文件 @
851b20ce
...
...
@@ -57,63 +57,79 @@ void OperatorBase<Dtype>::CheckAllInputOutputSet() const {}
template
<
typename
Dtype
>
void
OperatorBase
<
Dtype
>::
Run
()
{
DLOG
<<
" ----- Begin run impl --- "
<<
type_
<<
" ----- "
;
RunImpl
();
DLOG
<<
" ----- End run impl --- "
<<
type_
<<
" ----- "
;
//#ifdef PADDLE_MOBILE_DEBUG
// DLOG << "-------------" << type_ << "----------------------------";
// vector<string> input_keys = GetInputKeys();
// for (const auto key : input_keys) {
// auto var_vec_in = inputs_.at(key);
// for (int i = 0; i < var_vec_in.size(); ++i) {
// auto vari = scope_->FindVar(var_vec_in[i]);
// if (vari->IsInitialized()) {
//#ifdef PADDLE_MOBILE_CL
// if (type_ == "feed") {
// Tensor *tensor = vari->template
// GetMutable<framework::LoDTensor>(); if (tensor) DLOG << type_ << "
// input- " << key << "=" << *tensor;
// } else {
// CLImage *cl_image = vari->template
// GetMutable<framework::CLImage>(); if (cl_image) {
// DLOG << type_ << " input- " << key << "=" << *cl_image;
// }
// }
//
//#else
// Tensor *tensor = vari->template GetMutable<framework::LoDTensor>();
// if (tensor) DLOG << type_ << " input- " << key << "=" << *tensor;
//#endif
// }
// }
// }
// for (const auto key : GetOutKeys()) {
// auto var_vec_out = outputs_.at(key);
// for (int i = 0; i < var_vec_out.size(); ++i) {
// auto vari = scope_->FindVar(var_vec_out[i]);
// if (vari->IsInitialized()) {
//#ifdef PADDLE_MOBILE_CL
// if (type_ == "fetch") {
// Tensor *tensor = vari->template
// GetMutable<framework::LoDTensor>(); if (tensor) {
// DLOG << type_ << " output- " << key << "=" << *tensor;
// }
// } else {
// CLImage *cl_image = vari->template
// GetMutable<framework::CLImage>(); if (cl_image) {
// DLOG << type_ << " output- " << key << "=" << *cl_image;
// }
// }
//
//#else
// Tensor *tensor = vari->template GetMutable<framework::LoDTensor>();
// if (tensor) DLOG << type_ << " output- " << key << "=" << *tensor;
//#endif
// }
// }
// }
//#endif
#ifdef PADDLE_MOBILE_DEBUG
DLOG
<<
"-------------"
<<
type_
<<
"----------------------------"
;
vector
<
string
>
input_keys
=
GetInputKeys
();
for
(
const
auto
key
:
input_keys
)
{
auto
var_vec_in
=
inputs_
.
at
(
key
);
for
(
int
i
=
0
;
i
<
var_vec_in
.
size
();
++
i
)
{
auto
vari
=
scope_
->
FindVar
(
var_vec_in
[
i
]);
if
(
vari
->
IsInitialized
())
{
Tensor
*
tensor
=
vari
->
template
GetMutable
<
framework
::
LoDTensor
>();
if
(
tensor
)
DLOG
<<
type_
<<
" input- "
<<
key
<<
"="
<<
*
tensor
;
}
}
}
for
(
const
auto
key
:
GetOutKeys
())
{
auto
var_vec_out
=
outputs_
.
at
(
key
);
for
(
int
i
=
0
;
i
<
var_vec_out
.
size
();
++
i
)
{
auto
vari
=
scope_
->
FindVar
(
var_vec_out
[
i
]);
if
(
vari
->
IsInitialized
())
{
Tensor
*
tensor
=
vari
->
template
GetMutable
<
framework
::
LoDTensor
>();
if
(
tensor
)
DLOG
<<
type_
<<
" output- "
<<
key
<<
"="
<<
*
tensor
;
}
}
}
#endif
}
#ifdef PADDLE_MOBILE_CL
template
<
>
void
OperatorBase
<
GPU_CL
>::
Run
()
{
RunImpl
();
#ifdef PADDLE_MOBILE_DEBUG
DLOG
<<
"-------------"
<<
type_
<<
"----------------------------"
;
vector
<
string
>
input_keys
=
GetInputKeys
();
for
(
const
auto
key
:
input_keys
)
{
auto
var_vec_in
=
inputs_
.
at
(
key
);
for
(
int
i
=
0
;
i
<
var_vec_in
.
size
();
++
i
)
{
auto
vari
=
scope_
->
FindVar
(
var_vec_in
[
i
]);
if
(
vari
->
IsInitialized
())
{
if
(
type_
==
"feed"
)
{
Tensor
*
tensor
=
vari
->
template
GetMutable
<
framework
::
LoDTensor
>();
if
(
tensor
)
DLOG
<<
type_
<<
" input- "
<<
key
<<
"="
<<
*
tensor
;
}
else
{
CLImage
*
cl_image
=
vari
->
template
GetMutable
<
framework
::
CLImage
>();
if
(
cl_image
)
{
DLOG
<<
type_
<<
" input- "
<<
key
<<
"="
<<
*
cl_image
;
}
}
}
}
}
for
(
const
auto
key
:
GetOutKeys
())
{
auto
var_vec_out
=
outputs_
.
at
(
key
);
for
(
int
i
=
0
;
i
<
var_vec_out
.
size
();
++
i
)
{
auto
vari
=
scope_
->
FindVar
(
var_vec_out
[
i
]);
if
(
vari
->
IsInitialized
())
{
if
(
type_
==
"fetch"
)
{
Tensor
*
tensor
=
vari
->
template
GetMutable
<
framework
::
LoDTensor
>();
if
(
tensor
)
{
DLOG
<<
type_
<<
" output- "
<<
key
<<
"="
<<
*
tensor
;
}
}
else
{
CLImage
*
cl_image
=
vari
->
template
GetMutable
<
framework
::
CLImage
>();
if
(
cl_image
)
{
DLOG
<<
type_
<<
" output- "
<<
key
<<
"="
<<
*
cl_image
;
}
}
}
}
}
#endif
}
#endif
template
class
OperatorBase
<
CPU
>;
template
class
OperatorBase
<
FPGA
>;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录