提交 61de2b9e 编写于 作者: R Ray Liu 提交者: GitHub

Merge pull request #1234 from yangfei963158659/develop

modify operator.cpp
......@@ -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.
先完成此消息的编辑!
想要评论请 注册