diff --git a/src/operators/dropout_op.cpp b/src/operators/dropout_op.cpp index 5f68b5f8b5f5728bbcf85896c4bac3f6929456c9..1b2295a9c3c403cf2404fda6be691f715a33c5b8 100644 --- a/src/operators/dropout_op.cpp +++ b/src/operators/dropout_op.cpp @@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ +#ifdef DROPOUT_OP #include "operators/dropout_op.h" namespace paddle_mobile { namespace operators { @@ -26,5 +27,13 @@ template class DropoutOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; +#ifdef PADDLE_MOBILE_CPU USE_OP(Dropout); REGISTER_OPERATOR(dropout, ops::DropoutOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif + +#endif diff --git a/src/operators/dropout_op.h b/src/operators/dropout_op.h index 3943eed162bf48190e6c168d516d6d777c16dc78..d10008d37f93afc744dc3ea1ab8ce81294ea63bf 100644 --- a/src/operators/dropout_op.h +++ b/src/operators/dropout_op.h @@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ +#ifdef DROPOUT_OP + #pragma once #include @@ -26,7 +28,8 @@ namespace operators { using paddle_mobile::framework::Tensor; template -class DropoutOp : public framework::OperatorWithKernel { +class DropoutOp : public framework::OperatorWithKernel> { public: DropoutOp(const std::string &type, const VariableNameMap &inputs, const VariableNameMap &outputs, const framework::AttributeMap attrs, @@ -35,17 +38,15 @@ class DropoutOp : public framework::OperatorWithKernel { scope), param_(inputs, outputs, attrs, *scope) {} - void Run() const { - operators::DropoutKernel kernel; - kernel.Compute(param_); - } - - using framework::OperatorWithKernel::OperatorWithKernel; + using framework::OperatorWithKernel>; void InferShape() const override; protected: - DropoutParam param_; }; } // namespace operators } // namespace paddle_mobile + +#endif + diff --git a/src/operators/im2sequence_op.cpp b/src/operators/im2sequence_op.cpp index 58adcf22bf300cb4383c7358b033927895993884..ce05cb7d64dcfd0aeaad0bb1b6b6cec580817824 100644 --- a/src/operators/im2sequence_op.cpp +++ b/src/operators/im2sequence_op.cpp @@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ +#ifdef IM2SEQUENCE_OP + #include "operators/im2sequence_op.h" namespace paddle_mobile { @@ -51,5 +53,13 @@ template class Im2SequenceOp; } // namespace paddle_mobile namespace ops = paddle_mobile::operators; +#ifdef PADDLE_MOBILE_CPU USE_OP(im2sequence); REGISTER_OPERATOR(im2sequence, ops::Im2SequenceOp); +#endif +#ifdef PADDLE_MOBILE_MALI_GPU +#endif +#ifdef PADDLE_MOBILE_FPGA +#endif + +#endif diff --git a/src/operators/im2sequence_op.h b/src/operators/im2sequence_op.h index 6b7b4d291a051f4f95b82ae4b6f4ed2029511fea..40717bce9597cd8c82e2991fb10a574245738ef3 100644 --- a/src/operators/im2sequence_op.h +++ b/src/operators/im2sequence_op.h @@ -12,6 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ +#ifdef IM2SEQUENCE_OP + #pragma once #include @@ -24,7 +26,8 @@ namespace operators { using namespace framework; template -class Im2SequenceOp : public framework::OperatorWithKernel { +class Im2SequenceOp : public framework::OperatorWithKernel> { public: Im2SequenceOp(const std::string &type, const VariableNameMap &inputs, const VariableNameMap &outputs, @@ -34,18 +37,14 @@ class Im2SequenceOp : public framework::OperatorWithKernel { scope), param_(inputs, outputs, attrs, *scope) {} - using framework::OperatorWithKernel::OperatorWithKernel; + using framework::OperatorWithKernel>::OperatorWithKernel; void InferShape() const override; - void RunImpl() const { - operators::Im2SequenceKernel kernel; - kernel.Compute(param_); - this->ClearVariables({"X"}); - } - private: - Im2SequenceParam param_; }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/dropout_kernel.cpp b/src/operators/kernel/arm/dropout_kernel.cpp index 10e0a7cc8878c81a11cadba3665108d558619d41..32e2eeca8022be8e5c20c44ebd98e9b55530965d 100644 --- a/src/operators/kernel/arm/dropout_kernel.cpp +++ b/src/operators/kernel/arm/dropout_kernel.cpp @@ -20,6 +20,11 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { +template <> +bool DropoutKernel::Init(const DropoutParam ¶) const { + return true; +} + template struct DropoutFunctor { inline T operator()(T in) const { return in; } diff --git a/src/operators/kernel/arm/im2sequence_kernel.cpp b/src/operators/kernel/arm/im2sequence_kernel.cpp index 79e4d7bc4ad555ef3844a9a53f99f0dceb98ec01..254bfb8a5d5cc2e455f51ab032ba818b98cd466b 100644 --- a/src/operators/kernel/arm/im2sequence_kernel.cpp +++ b/src/operators/kernel/arm/im2sequence_kernel.cpp @@ -17,6 +17,11 @@ limitations under the License. */ namespace paddle_mobile { namespace operators { +template <> +bool Im2SequenceKernel::Init(const Im2SequenceParam ¶) const { + return true; +} + inline int Im2SeqOutputSize(int input_size, int filter_size, int padding_0, int padding_1, int stride) { const int output_size = diff --git a/src/operators/kernel/dropout_kernel.h b/src/operators/kernel/dropout_kernel.h index 92caab1c7a525d669a418ff5ca9cab5b8ea07878..98146fab73e1e5b5ba96925a9a956944318d8fca 100644 --- a/src/operators/kernel/dropout_kernel.h +++ b/src/operators/kernel/dropout_kernel.h @@ -24,6 +24,7 @@ template class DropoutKernel : public framework::OpKernelBase { public: void Compute(const DropoutParam& param) const; + bool Init(const DropoutParam ¶) const; }; } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/kernel/im2sequence_kernel.h b/src/operators/kernel/im2sequence_kernel.h index c0a1aff1da353689993cef65215f745c382fc2e3..0b02a7bd4d422479170bb066a48bbe91c0b92cec 100644 --- a/src/operators/kernel/im2sequence_kernel.h +++ b/src/operators/kernel/im2sequence_kernel.h @@ -30,6 +30,7 @@ class Im2SequenceKernel : public framework::OpKernelBase { public: void Compute(const Im2SequenceParam ¶m) const; + bool Init(const Im2SequenceParam ¶) const; }; } // namespace operators } // namespace paddle_mobile