From 8796d1dcb2a1ca339862522e9af8fd41e5c5f49a Mon Sep 17 00:00:00 2001 From: hanbuhe Date: Thu, 16 Aug 2018 15:15:02 +0800 Subject: [PATCH] feed op type mismatch --- src/framework/tensor.h | 6 ++++-- src/operators/feed_op.h | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/framework/tensor.h b/src/framework/tensor.h index 721d4ea5e9..aaf348fd82 100644 --- a/src/framework/tensor.h +++ b/src/framework/tensor.h @@ -29,6 +29,8 @@ limitations under the License. */ #include "framework/ddim.h" #include "memory/t_malloc.h" +#include "common/stack_trace.h" + namespace paddle_mobile { namespace framework { template @@ -116,8 +118,8 @@ class Tensor { PADDLE_MOBILE_ENFORCE( (std::is_same::value || holder_->type().hash_code() == typeid(T).hash_code()), - "Tensor holds the wrong type, it holds %s", - this->holder_->type().name()); + "Tensor holds the wrong type, it holds %s ,requested:%s", + this->holder_->type().name(), typeid(T).name()); return reinterpret_cast( reinterpret_cast(holder_->ptr()) + offset_); diff --git a/src/operators/feed_op.h b/src/operators/feed_op.h index 9b63203411..5969e67955 100644 --- a/src/operators/feed_op.h +++ b/src/operators/feed_op.h @@ -36,9 +36,14 @@ class FeedOp : public framework::OperatorBase { out_dims[0] = param_.BatchSize(); param_.Out()->Resize(out_dims); } - void Init() {} #ifdef PADDLE_MOBILE_FPGA + + void Init() { + Tensor *output = param_.Out(); + output->mutable_data(); + } + void RunImpl() const { const Tensor *input = param_.InputX(); auto input_ptr = input->data(); @@ -56,6 +61,7 @@ class FeedOp : public framework::OperatorBase { } #else + void Init() {} void RunImpl() const { param_.Out()->ShareDataWith(*param_.InputX()); } #endif -- GitLab