From 0186dee5cd05c11d611f50daa5d9eaa034319cc1 Mon Sep 17 00:00:00 2001 From: "Yao,kun" Date: Mon, 2 Jul 2018 12:13:32 +0800 Subject: [PATCH] Add marco --- src/operators/dropout_op.cpp | 4 ++-- src/operators/dropout_op.h | 7 ++++--- src/operators/im2sequence_op.cpp | 4 ++-- src/operators/im2sequence_op.h | 8 +++++--- src/operators/kernel/arm/dropout_kernel.cpp | 4 ++++ src/operators/kernel/arm/im2sequence_kernel.cpp | 4 ++++ src/operators/kernel/dropout_kernel.h | 4 ++++ src/operators/kernel/im2sequence_kernel.h | 4 ++++ 8 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/operators/dropout_op.cpp b/src/operators/dropout_op.cpp index 1b2295a9c3..f59c838b92 100644 --- a/src/operators/dropout_op.cpp +++ b/src/operators/dropout_op.cpp @@ -28,8 +28,8 @@ template class DropoutOp; namespace ops = paddle_mobile::operators; #ifdef PADDLE_MOBILE_CPU -USE_OP(Dropout); -REGISTER_OPERATOR(dropout, ops::DropoutOp); +USE_OP_CPU(Dropout); +REGISTER_OPERATOR_CPU(dropout, ops::DropoutOp); #endif #ifdef PADDLE_MOBILE_MALI_GPU #endif diff --git a/src/operators/dropout_op.h b/src/operators/dropout_op.h index 380071dba2..245160d18e 100644 --- a/src/operators/dropout_op.h +++ b/src/operators/dropout_op.h @@ -30,13 +30,14 @@ using paddle_mobile::framework::Tensor; template class DropoutOp : public framework::OperatorWithKernel< - DeviceType, DropoutParam, operators::DropoutKernal> { + DeviceType, DropoutParam, operators::DropoutKernel> { public: DropoutOp(const std::string &type, const VariableNameMap &inputs, const VariableNameMap &outputs, const framework::AttributeMap attrs, std::shared_ptr scope) - : framework::OperatorWithKernel(type, inputs, outputs, attrs, - scope), + : framework::OperatorWithKernel>( + type, inputs, outputs, attrs, scope), param_(inputs, outputs, attrs, *scope) {} using framework::OperatorWithKernel; namespace ops = paddle_mobile::operators; #ifdef PADDLE_MOBILE_CPU -USE_OP(im2sequence); -REGISTER_OPERATOR(im2sequence, ops::Im2SequenceOp); +USE_OP_CPU(im2sequence); +REGISTER_OPERATOR_CPU(im2sequence, ops::Im2SequenceOp); #endif #ifdef PADDLE_MOBILE_MALI_GPU #endif diff --git a/src/operators/im2sequence_op.h b/src/operators/im2sequence_op.h index 0b0085e4ce..9ecd76d567 100644 --- a/src/operators/im2sequence_op.h +++ b/src/operators/im2sequence_op.h @@ -28,14 +28,16 @@ using namespace framework; template class Im2SequenceOp : public framework::OperatorWithKernel< DeviceType, Im2SequenceParam, - operators::Im2SequenceKernal> { + operators::Im2SequenceKernel> { public: Im2SequenceOp(const std::string &type, const VariableNameMap &inputs, const VariableNameMap &outputs, const framework::AttributeMap &attrs, std::shared_ptr scope) - : framework::OperatorWithKernel(type, inputs, outputs, attrs, - scope), + : framework::OperatorWithKernel< + DeviceType, Im2SequenceParam, + operators::Im2SequenceKernel>(type, inputs, outputs, + attrs, scope), param_(inputs, outputs, attrs, *scope) {} using framework::OperatorWithKernel< diff --git a/src/operators/kernel/arm/dropout_kernel.cpp b/src/operators/kernel/arm/dropout_kernel.cpp index 868723be22..ea682809fb 100644 --- a/src/operators/kernel/arm/dropout_kernel.cpp +++ b/src/operators/kernel/arm/dropout_kernel.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 DROPOUT_OP + #pragma once #include "operators/kernel/dropout_kernel.h" @@ -43,3 +45,5 @@ void DropoutKernel::Compute(const DropoutParam ¶m) const { } } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/im2sequence_kernel.cpp b/src/operators/kernel/arm/im2sequence_kernel.cpp index 0a4873d4d8..46833b1062 100644 --- a/src/operators/kernel/arm/im2sequence_kernel.cpp +++ b/src/operators/kernel/arm/im2sequence_kernel.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/kernel/im2sequence_kernel.h" namespace paddle_mobile { @@ -72,3 +74,5 @@ template class Im2SequenceKernel; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/dropout_kernel.h b/src/operators/kernel/dropout_kernel.h index 42b914b175..7cf5ed28d6 100644 --- a/src/operators/kernel/dropout_kernel.h +++ b/src/operators/kernel/dropout_kernel.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 + #include "framework/operator.h" #include "operators/op_param.h" @@ -28,3 +30,5 @@ class DropoutKernel : public framework::OpKernelBase { }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/im2sequence_kernel.h b/src/operators/kernel/im2sequence_kernel.h index 0b02a7bd4d..0d211ff6b1 100644 --- a/src/operators/kernel/im2sequence_kernel.h +++ b/src/operators/kernel/im2sequence_kernel.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 + #include "framework/operator.h" #include "operators/math/im2col.h" #include "operators/math/math_function.h" @@ -34,3 +36,5 @@ class Im2SequenceKernel }; } // namespace operators } // namespace paddle_mobile + +#endif -- GitLab