未验证 提交 a73884e5 编写于 作者: Z zhangyang0701 提交者: GitHub

Merge pull request #788 from chonwhite/develop

fix:#787
...@@ -116,8 +116,8 @@ class Tensor { ...@@ -116,8 +116,8 @@ class Tensor {
PADDLE_MOBILE_ENFORCE( PADDLE_MOBILE_ENFORCE(
(std::is_same<T, void>::value || (std::is_same<T, void>::value ||
holder_->type().hash_code() == typeid(T).hash_code()), holder_->type().hash_code() == typeid(T).hash_code()),
"Tensor holds the wrong type, it holds %s", "Tensor holds the wrong type, it holds %s ,requested:%s",
this->holder_->type().name()); this->holder_->type().name(), typeid(T).name());
return reinterpret_cast<const T *>( return reinterpret_cast<const T *>(
reinterpret_cast<uintptr_t>(holder_->ptr()) + offset_); reinterpret_cast<uintptr_t>(holder_->ptr()) + offset_);
......
...@@ -36,9 +36,14 @@ class FeedOp : public framework::OperatorBase<DeviceType> { ...@@ -36,9 +36,14 @@ class FeedOp : public framework::OperatorBase<DeviceType> {
out_dims[0] = param_.BatchSize(); out_dims[0] = param_.BatchSize();
param_.Out()->Resize(out_dims); param_.Out()->Resize(out_dims);
} }
void Init() {}
#ifdef PADDLE_MOBILE_FPGA #ifdef PADDLE_MOBILE_FPGA
void Init() {
Tensor *output = param_.Out();
output->mutable_data<half>();
}
void RunImpl() const { void RunImpl() const {
const Tensor *input = param_.InputX(); const Tensor *input = param_.InputX();
auto input_ptr = input->data<float>(); auto input_ptr = input->data<float>();
...@@ -56,6 +61,7 @@ class FeedOp : public framework::OperatorBase<DeviceType> { ...@@ -56,6 +61,7 @@ class FeedOp : public framework::OperatorBase<DeviceType> {
} }
#else #else
void Init() {}
void RunImpl() const { param_.Out()->ShareDataWith(*param_.InputX()); } void RunImpl() const { param_.Out()->ShareDataWith(*param_.InputX()); }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册