From acf3f361ecb15598501b7523ad289a4bd78d97a2 Mon Sep 17 00:00:00 2001 From: qnqinan Date: Mon, 11 Mar 2019 15:27:33 +0800 Subject: [PATCH] update --- src/operators/activation_op.cpp | 1 + src/operators/kernel/fpga/V1/relu_kernel.cpp | 2 +- src/operators/kernel/relu_kernel.h | 31 ------------- src/operators/relu_op.cpp | 45 ------------------ src/operators/relu_op.h | 49 -------------------- 5 files changed, 2 insertions(+), 126 deletions(-) delete mode 100644 src/operators/kernel/relu_kernel.h delete mode 100644 src/operators/relu_op.cpp delete mode 100644 src/operators/relu_op.h diff --git a/src/operators/activation_op.cpp b/src/operators/activation_op.cpp index 76c9e1a014..d98fcb9229 100644 --- a/src/operators/activation_op.cpp +++ b/src/operators/activation_op.cpp @@ -58,6 +58,7 @@ REGISTER_OPERATOR_CPU(relu6, ops::Relu6Op); REGISTER_OPERATOR_MALI_GPU(relu, ops::ReluOp); #endif #ifdef PADDLE_MOBILE_FPGA +REGISTER_OPERATOR_FPGA(relu, ops::ReluOp); #endif #ifdef PADDLE_MOBILE_CL REGISTER_OPERATOR_CL(relu, ops::ReluOp); diff --git a/src/operators/kernel/fpga/V1/relu_kernel.cpp b/src/operators/kernel/fpga/V1/relu_kernel.cpp index 3d72aedba6..6fff10f620 100644 --- a/src/operators/kernel/fpga/V1/relu_kernel.cpp +++ b/src/operators/kernel/fpga/V1/relu_kernel.cpp @@ -14,7 +14,7 @@ limitations under the License. */ #ifdef RELU_OP -#include "operators/kernel/relu_kernel.h" +#include "operators/kernel/activation_kernel.h" namespace paddle_mobile { namespace operators { diff --git a/src/operators/kernel/relu_kernel.h b/src/operators/kernel/relu_kernel.h deleted file mode 100644 index ee279ff21b..0000000000 --- a/src/operators/kernel/relu_kernel.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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. */ - -#include "framework/operator.h" -#include "operators/op_param.h" - -#pragma once - -namespace paddle_mobile { -namespace operators { - -template -class ReluKernel - : public framework::OpKernelBase> { - public: - void Compute(const ReluParam& param); - bool Init(ReluParam* param); -}; -} // namespace operators -} // namespace paddle_mobile diff --git a/src/operators/relu_op.cpp b/src/operators/relu_op.cpp deleted file mode 100644 index c51f625f81..0000000000 --- a/src/operators/relu_op.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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 RELU_OP - -#include "operators/relu_op.h" -namespace paddle_mobile { -namespace operators { - -template -void ReluOp::InferShape() const { - auto input_dims = this->param_.InputX()->dims(); - this->param_.Out()->Resize(input_dims); -} - -} // namespace operators -} // namespace paddle_mobile - -/* - * @b 每一个 op 都需要注册一下的, - * USE_OP的参数 和 REGISTER_OPERATOR的第一个参数 - * 都是需要和model中类型对应起来的 - * */ -namespace ops = paddle_mobile::operators; -#ifdef PADDLE_MOBILE_CPU -REGISTER_OPERATOR_CPU(relu, ops::ReluOp); -#endif -#ifdef PADDLE_MOBILE_MALI_GPU -REGISTER_OPERATOR_MALI_GPU(relu, ops::ReluOp); -#endif -#ifdef PADDLE_MOBILE_FPGA -REGISTER_OPERATOR_FPGA(relu, ops::ReluOp); -#endif -#endif diff --git a/src/operators/relu_op.h b/src/operators/relu_op.h deleted file mode 100644 index da6e2b5d22..0000000000 --- a/src/operators/relu_op.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -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 RELU_OP - -#pragma once - -#include - -#include "framework/operator.h" -#include "operators/kernel/relu_kernel.h" -#include "operators/op_param.h" - -namespace paddle_mobile { -namespace operators { - -using paddle_mobile::framework::Tensor; - -template -class ReluOp : public framework::OperatorWithKernel< - DeviceType, ReluParam, - operators::ReluKernel> { - public: - ReluOp(const std::string &type, const VariableNameMap &inputs, - const VariableNameMap &outputs, const framework::AttributeMap &attrs, - std::shared_ptr scope) - : framework::OperatorWithKernel, - operators::ReluKernel>( - type, inputs, outputs, attrs, scope) {} - void InferShape() const override; - - protected: -}; - -} // namespace operators -} // namespace paddle_mobile - -#endif -- GitLab