diff --git a/src/operators/activation_op.cpp b/src/operators/activation_op.cpp index 76c9e1a014bc0e51b032d8516ba9448fa25b2aa5..d98fcb92297dd485fc3e59cfe592e00672f4ffca 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 3d72aedba6113657ed3b4248602c50f4d5ef5e41..6fff10f6206212379e865f2041e3d35cca955bfd 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 ee279ff21b6a2e7f63250d2fe376e953ea7835f5..0000000000000000000000000000000000000000 --- 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 c51f625f8179a2b608259b2c2d1016be600eda8a..0000000000000000000000000000000000000000 --- 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 da6e2b5d2275c5d48881de70f24552c62adf3821..0000000000000000000000000000000000000000 --- 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