提交 8796d1dc 编写于 作者: H hanbuhe

feed op type mismatch

上级 d6b73958
......@@ -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 <typename... T>
......@@ -116,8 +118,8 @@ class Tensor {
PADDLE_MOBILE_ENFORCE(
(std::is_same<T, void>::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<const T *>(
reinterpret_cast<uintptr_t>(holder_->ptr()) + offset_);
......
......@@ -36,9 +36,14 @@ class FeedOp : public framework::OperatorBase<DeviceType> {
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<half>();
}
void RunImpl() const {
const Tensor *input = param_.InputX();
auto input_ptr = input->data<float>();
......@@ -56,6 +61,7 @@ class FeedOp : public framework::OperatorBase<DeviceType> {
}
#else
void Init() {}
void RunImpl() const { param_.Out()->ShareDataWith(*param_.InputX()); }
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册