From 5d5e99600df2aeb4a77a19c4ca918f955b078507 Mon Sep 17 00:00:00 2001 From: zhangyang Date: Tue, 7 Aug 2018 23:08:53 +0800 Subject: [PATCH] recover InferShape() function --- src/operators/feed_op.h | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/operators/feed_op.h b/src/operators/feed_op.h index 8056e78aed..b34c7cf78b 100644 --- a/src/operators/feed_op.h +++ b/src/operators/feed_op.h @@ -31,12 +31,14 @@ class FeedOp : public framework::OperatorBase { scope), param_(inputs, outputs, attrs, scope.get()) {} - protected: - FeedParam param_; + void InferShape() const { + auto out_dims = param_.Out()->dims(); + out_dims[0] = param_.BatchSize(); + param_.Out()->Resize(out_dims); + } #ifdef PADDLE_MOBILE_FPGA void RunImpl() const { fpga::PerformBypass(param_.FpgaArgs()); } - void Init() { const Tensor *input = param_.InputX(); auto input_ptr = input->data(); @@ -53,22 +55,13 @@ class FeedOp : public framework::OperatorBase { param_.SetFpgaArgs(args); } - void InferShape() const { - auto out_dims = param_.Out()->dims(); - out_dims[0] = param_.BatchSize(); - param_.Out()->Resize(out_dims); - param_.Out()->ShareDataWith(*param_.InputX()); // TODO How to handle fp16 - } #else void RunImpl() const { param_.Out()->ShareDataWith(*param_.InputX()); } - void Init() {} - - void InferShape() const { - auto out_dims = param_.Out()->dims(); - out_dims[0] = param_.BatchSize(); - param_.Out()->Resize(out_dims); #endif + + protected: + FeedParam param_; }; } // namespace operators -- GitLab