提交 ceed07b7 编写于 作者: Y yangfei

modify operator.cpp

上级 136e78cd
...@@ -57,63 +57,79 @@ void OperatorBase<Dtype>::CheckAllInputOutputSet() const {} ...@@ -57,63 +57,79 @@ void OperatorBase<Dtype>::CheckAllInputOutputSet() const {}
template <typename Dtype> template <typename Dtype>
void OperatorBase<Dtype>::Run() { void OperatorBase<Dtype>::Run() {
DLOG << " ----- Begin run impl --- " << type_ << " ----- ";
RunImpl(); RunImpl();
DLOG << " ----- End run impl --- " << type_ << " ----- "; #ifdef PADDLE_MOBILE_DEBUG
//#ifdef PADDLE_MOBILE_DEBUG DLOG << "-------------" << type_ << "----------------------------";
// DLOG << "-------------" << type_ << "----------------------------"; vector<string> input_keys = GetInputKeys();
// vector<string> input_keys = GetInputKeys(); for (const auto key : input_keys) {
// for (const auto key : input_keys) { auto var_vec_in = inputs_.at(key);
// auto var_vec_in = inputs_.at(key); for (int i = 0; i < var_vec_in.size(); ++i) {
// for (int i = 0; i < var_vec_in.size(); ++i) { auto vari = scope_->FindVar(var_vec_in[i]);
// auto vari = scope_->FindVar(var_vec_in[i]); if (vari->IsInitialized()) {
// if (vari->IsInitialized()) { Tensor *tensor = vari->template GetMutable<framework::LoDTensor>();
//#ifdef PADDLE_MOBILE_CL if (tensor) DLOG << type_ << " input- " << key << "=" << *tensor;
// if (type_ == "feed") { }
// Tensor *tensor = vari->template }
// GetMutable<framework::LoDTensor>(); if (tensor) DLOG << type_ << " }
// input- " << key << "=" << *tensor; for (const auto key : GetOutKeys()) {
// } else { auto var_vec_out = outputs_.at(key);
// CLImage *cl_image = vari->template for (int i = 0; i < var_vec_out.size(); ++i) {
// GetMutable<framework::CLImage>(); if (cl_image) { auto vari = scope_->FindVar(var_vec_out[i]);
// DLOG << type_ << " input- " << key << "=" << *cl_image; if (vari->IsInitialized()) {
// } Tensor *tensor = vari->template GetMutable<framework::LoDTensor>();
// } if (tensor) DLOG << type_ << " output- " << key << "=" << *tensor;
// }
//#else }
// Tensor *tensor = vari->template GetMutable<framework::LoDTensor>(); }
// if (tensor) DLOG << type_ << " input- " << key << "=" << *tensor; #endif
//#endif }
// }
// } #ifdef PADDLE_MOBILE_CL
// } template <>
// for (const auto key : GetOutKeys()) { void OperatorBase<GPU_CL>::Run() {
// auto var_vec_out = outputs_.at(key); RunImpl();
// for (int i = 0; i < var_vec_out.size(); ++i) { #ifdef PADDLE_MOBILE_DEBUG
// auto vari = scope_->FindVar(var_vec_out[i]); DLOG << "-------------" << type_ << "----------------------------";
// if (vari->IsInitialized()) { vector<string> input_keys = GetInputKeys();
//#ifdef PADDLE_MOBILE_CL for (const auto key : input_keys) {
// if (type_ == "fetch") { auto var_vec_in = inputs_.at(key);
// Tensor *tensor = vari->template for (int i = 0; i < var_vec_in.size(); ++i) {
// GetMutable<framework::LoDTensor>(); if (tensor) { auto vari = scope_->FindVar(var_vec_in[i]);
// DLOG << type_ << " output- " << key << "=" << *tensor; if (vari->IsInitialized()) {
// } if (type_ == "feed") {
// } else { Tensor *tensor = vari->template GetMutable<framework::LoDTensor>();
// CLImage *cl_image = vari->template if (tensor) DLOG << type_ << " input- " << key << "=" << *tensor;
// GetMutable<framework::CLImage>(); if (cl_image) { } else {
// DLOG << type_ << " output- " << key << "=" << *cl_image; 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_ << " output- " << 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) {
//#endif 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<CPU>;
template class OperatorBase<FPGA>; template class OperatorBase<FPGA>;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册