未验证 提交 9188571c 编写于 作者: X xiebaiyuan 提交者: GitHub

[mobile][opencl] suite inputs or outputs mismatch,,test=mobile (#2698)

上级 165b02f1
...@@ -62,31 +62,39 @@ void OperatorBase<Dtype>::Run() { ...@@ -62,31 +62,39 @@ void OperatorBase<Dtype>::Run() {
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); if (inputs_.count(key) > 0) {
for (int i = 0; i < var_vec_in.size(); ++i) { auto var_vec_in = inputs_.at(key);
auto var = this->scope_->FindVar(var_vec_in[i]); for (int i = 0; i < var_vec_in.size(); ++i) {
if (var->IsInitialized() && auto var = this->scope_->FindVar(var_vec_in[i]);
var->template IsType<framework::LoDTensor>()) { if (var->IsInitialized() &&
const Tensor *tensor = var->template Get<framework::LoDTensor>(); var->template IsType<framework::LoDTensor>()) {
if (tensor) DLOG << type_ << " input- " << key << "=" << *tensor; const Tensor *tensor = var->template Get<framework::LoDTensor>();
if (tensor) DLOG << type_ << " input- " << key << "=" << *tensor;
#ifdef PADDLE_MOBILE_FPGA #ifdef PADDLE_MOBILE_FPGA
DLOG << var_vec_in[i]; DLOG << var_vec_in[i];
#endif #endif
}
} }
} else {
DLOG << "did not find key (" << key << ") in inputs_";
} }
} }
for (const auto key : GetOutKeys()) { for (const auto key : GetOutKeys()) {
auto var_vec_out = outputs_.at(key); if (outputs_.count(key) > 0) {
for (int i = 0; i < var_vec_out.size(); ++i) { auto var_vec_out = outputs_.at(key);
auto var = scope_->FindVar(var_vec_out[i]); for (int i = 0; i < var_vec_out.size(); ++i) {
if (var->IsInitialized() && auto var = scope_->FindVar(var_vec_out[i]);
var->template IsType<framework::LoDTensor>()) { if (var->IsInitialized() &&
const Tensor *tensor = var->template Get<framework::LoDTensor>(); var->template IsType<framework::LoDTensor>()) {
if (tensor) DLOG << type_ << " output- " << key << "=" << *tensor; const Tensor *tensor = var->template Get<framework::LoDTensor>();
if (tensor) DLOG << type_ << " output- " << key << "=" << *tensor;
#ifdef PADDLE_MOBILE_FPGA #ifdef PADDLE_MOBILE_FPGA
DLOG << var_vec_out[i]; DLOG << var_vec_out[i];
#endif #endif
}
} }
} else {
DLOG << "did not find key (" << key << ") in outputs_";
} }
} }
#endif #endif
...@@ -100,27 +108,37 @@ void OperatorBase<GPU_CL>::Run() { ...@@ -100,27 +108,37 @@ void OperatorBase<GPU_CL>::Run() {
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); if (inputs_.count(key) > 0) {
for (int i = 0; i < var_vec_in.size(); ++i) { auto var_vec_in = inputs_.at(key);
auto var = scope_->FindVar(var_vec_in[i]); for (int i = 0; i < var_vec_in.size(); ++i) {
if (var->IsInitialized() && var->template IsType<framework::CLImage>()) { auto var = scope_->FindVar(var_vec_in[i]);
const CLImage *cl_image = var->template Get<framework::CLImage>(); if (var->IsInitialized() &&
if (cl_image) { var->template IsType<framework::CLImage>()) {
DLOG << type_ << " input- " << key << "=" << *cl_image; const CLImage *cl_image = var->template Get<framework::CLImage>();
if (cl_image) {
DLOG << type_ << " input- " << key << "=" << *cl_image;
}
} }
} }
} else {
DLOG << "did not find key (" << key << ") in inputs_";
} }
} }
for (const auto key : GetOutKeys()) { for (const auto key : GetOutKeys()) {
auto var_vec_out = outputs_.at(key); if (outputs_.count(key) > 0) {
for (int i = 0; i < var_vec_out.size(); ++i) { auto var_vec_out = outputs_.at(key);
auto var = scope_->FindVar(var_vec_out[i]); for (int i = 0; i < var_vec_out.size(); ++i) {
if (var->IsInitialized() && var->template IsType<framework::CLImage>()) { auto var = scope_->FindVar(var_vec_out[i]);
const CLImage *cl_image = var->template Get<framework::CLImage>(); if (var->IsInitialized() &&
if (cl_image) { var->template IsType<framework::CLImage>()) {
DLOG << type_ << " output- " << key << "=" << *cl_image; const CLImage *cl_image = var->template Get<framework::CLImage>();
if (cl_image) {
DLOG << type_ << " output- " << key << "=" << *cl_image;
}
} }
} }
} else {
DLOG << "did not find key (" << key << ") in outputs_";
} }
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册