From 2cd8c947690771b752ec06489270bd54ec451dde Mon Sep 17 00:00:00 2001 From: "Yao,kun" Date: Mon, 2 Jul 2018 12:33:49 +0800 Subject: [PATCH] bugfix --- src/operators/dropout_op.cpp | 6 +++--- src/operators/dropout_op.h | 7 +++---- src/operators/im2sequence_op.cpp | 10 +++++----- src/operators/im2sequence_op.h | 9 ++++----- src/operators/kernel/arm/dropout_kernel.cpp | 2 +- src/operators/kernel/arm/im2sequence_kernel.cpp | 2 +- src/operators/kernel/dropout_kernel.h | 2 +- src/operators/kernel/im2sequence_kernel.h | 2 +- tools/op.cmake | 4 ++-- 9 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/operators/dropout_op.cpp b/src/operators/dropout_op.cpp index f59c838b92..ade81ac7fa 100644 --- a/src/operators/dropout_op.cpp +++ b/src/operators/dropout_op.cpp @@ -19,8 +19,8 @@ namespace operators { template void DropoutOp::InferShape() const { - auto input_dims = param_.InputX()->dims(); - param_.Out()->Resize(input_dims); + auto input_dims = thsi->param_.InputX()->dims(); + this->param_.Out()->Resize(input_dims); } template class DropoutOp; } // namespace operators @@ -28,7 +28,7 @@ template class DropoutOp; namespace ops = paddle_mobile::operators; #ifdef PADDLE_MOBILE_CPU -USE_OP_CPU(Dropout); +USE_OP_CPU(dropout); REGISTER_OPERATOR_CPU(dropout, ops::DropoutOp); #endif #ifdef PADDLE_MOBILE_MALI_GPU diff --git a/src/operators/dropout_op.h b/src/operators/dropout_op.h index 245160d18e..3fcafc331a 100644 --- a/src/operators/dropout_op.h +++ b/src/operators/dropout_op.h @@ -37,11 +37,10 @@ class DropoutOp std::shared_ptr scope) : framework::OperatorWithKernel>( - type, inputs, outputs, attrs, scope), - param_(inputs, outputs, attrs, *scope) {} + type, inputs, outputs, attrs, scope) {} - using framework::OperatorWithKernel>; + //using framework::OperatorWithKernel>; void InferShape() const override; protected: diff --git a/src/operators/im2sequence_op.cpp b/src/operators/im2sequence_op.cpp index 2754540f0f..2cb2d6398f 100644 --- a/src/operators/im2sequence_op.cpp +++ b/src/operators/im2sequence_op.cpp @@ -28,13 +28,13 @@ int Im2SequenceOutputSize(int input_size, int kernel, int padding_1, template void Im2SequenceOp::InferShape() const { - auto in_x_dims = param_.Input()->dims(); + auto in_x_dims = this->param_.Input()->dims(); - const std::vector &kernels = param_.Kernels(); + const std::vector &kernels = this->param_.Kernels(); - const std::vector &strides = param_.Strides(); + const std::vector &strides = this->param_.Strides(); - std::vector paddings = param_.Paddings(); + std::vector paddings = this->param_.Paddings(); std::vector output_shape({in_x_dims[0], in_x_dims[1]}); for (size_t i = 0; i < strides.size(); ++i) { @@ -44,7 +44,7 @@ void Im2SequenceOp::InferShape() const { } framework::DDim ddim = framework::make_ddim(output_shape); - param_.Output()->Resize(ddim); + this->param_.Output()->Resize(ddim); } template class Im2SequenceOp; diff --git a/src/operators/im2sequence_op.h b/src/operators/im2sequence_op.h index 9ecd76d567..7cc4429806 100644 --- a/src/operators/im2sequence_op.h +++ b/src/operators/im2sequence_op.h @@ -37,12 +37,11 @@ class Im2SequenceOp : public framework::OperatorWithKernel< : framework::OperatorWithKernel< DeviceType, Im2SequenceParam, operators::Im2SequenceKernel>(type, inputs, outputs, - attrs, scope), - param_(inputs, outputs, attrs, *scope) {} + attrs, scope) {} - using framework::OperatorWithKernel< - DeviceType, Im2SequenceParam, - operators::Im2SequenceKernel>::OperatorWithKernel; + //using framework::OperatorWithKernel< + // DeviceType, Im2SequenceParam, + // operators::Im2SequenceKernel>::OperatorWithKernel; void InferShape() const override; private: diff --git a/src/operators/kernel/arm/dropout_kernel.cpp b/src/operators/kernel/arm/dropout_kernel.cpp index ea682809fb..af16048a1b 100644 --- a/src/operators/kernel/arm/dropout_kernel.cpp +++ b/src/operators/kernel/arm/dropout_kernel.cpp @@ -23,7 +23,7 @@ namespace paddle_mobile { namespace operators { template <> -bool DropoutKernel::Init(const DropoutParam ¶) const { +bool DropoutKernel::Init(DropoutParam *para) { return true; } diff --git a/src/operators/kernel/arm/im2sequence_kernel.cpp b/src/operators/kernel/arm/im2sequence_kernel.cpp index 46833b1062..709fa30a23 100644 --- a/src/operators/kernel/arm/im2sequence_kernel.cpp +++ b/src/operators/kernel/arm/im2sequence_kernel.cpp @@ -20,7 +20,7 @@ namespace paddle_mobile { namespace operators { template <> -bool Im2SequenceKernel::Init(const Im2SequenceParam ¶) const { +bool Im2SequenceKernel::Init(Im2SequenceParam *para) { return true; } diff --git a/src/operators/kernel/dropout_kernel.h b/src/operators/kernel/dropout_kernel.h index 7cf5ed28d6..0b217d7d31 100644 --- a/src/operators/kernel/dropout_kernel.h +++ b/src/operators/kernel/dropout_kernel.h @@ -26,7 +26,7 @@ template class DropoutKernel : public framework::OpKernelBase { public: void Compute(const DropoutParam& param) const; - bool Init(const DropoutParam& para) const; + bool Init(DropoutParam *para); }; } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/im2sequence_kernel.h b/src/operators/kernel/im2sequence_kernel.h index 0d211ff6b1..1c3249dda7 100644 --- a/src/operators/kernel/im2sequence_kernel.h +++ b/src/operators/kernel/im2sequence_kernel.h @@ -32,7 +32,7 @@ class Im2SequenceKernel : public framework::OpKernelBase { public: void Compute(const Im2SequenceParam ¶m) const; - bool Init(const Im2SequenceParam ¶) const; + bool Init(Im2SequenceParam* para); }; } // namespace operators } // namespace paddle_mobile diff --git a/tools/op.cmake b/tools/op.cmake index 8c9182f900..8ddf739b5f 100644 --- a/tools/op.cmake +++ b/tools/op.cmake @@ -156,6 +156,6 @@ endif() if (DROPOUT_OP) add_definitions(-DDROPOUT_OP) endif() -if (IM2SQUENCE_OP) - add_definitions(-DIM2SQUENCE_OP) +if (IM2SEQUENCE_OP) + add_definitions(-DIM2SEQUENCE_OP) endif() -- GitLab