diff --git a/src/framework/load_ops.h b/src/framework/load_ops.h index 3beae9eddd322b2df33090268c9c4fd1b38fa57b..2738e2470ecdfcde6f259e3f20be80bebdd4c925 100644 --- a/src/framework/load_ops.h +++ b/src/framework/load_ops.h @@ -127,6 +127,9 @@ LOAD_OP2(transpose2, CPU, GPU_CL); #ifdef PRIORBOX_OP LOAD_OP2(prior_box, CPU, GPU_CL); #endif +#ifdef DENSITY_PRIORBOX_OP +LOAD_OP2(density_prior_box, CPU, GPU_CL); +#endif #ifdef FUSION_CONVADDRELU_OP LOAD_OP3(fusion_conv_add_relu, CPU, GPU_CL, FPGA); LOAD_FUSION_MATCHER(fusion_conv_add_relu); @@ -158,7 +161,9 @@ LOAD_OP1(prelu, CPU); #endif #ifdef FLATTEN_OP LOAD_OP1(flatten, CPU); -LOAD_OP1(flatten2, CPU); +#endif +#ifdef FLATTEN2_OP +LOAD_OP2(flatten2, CPU, GPU_CL); #endif #ifdef FUSION_CONVBNADDRELU_OP LOAD_OP3(fusion_conv_bn_add_relu, CPU, GPU_CL, FPGA); diff --git a/src/operators/flatten2_op.cpp b/src/operators/flatten2_op.cpp new file mode 100644 index 0000000000000000000000000000000000000000..99addf0fdbd8b7f6ca2eb553e46db3b56eb47f44 --- /dev/null +++ b/src/operators/flatten2_op.cpp @@ -0,0 +1,32 @@ +/* Copyright (c) 2019 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 FLATTEN2_OP + +#include "operators/flatten2_op.h" +namespace paddle_mobile { +namespace operators { +template +void Flatten2Op::InferShape() const {} + +} // namespace operators +} // namespace paddle_mobile + +namespace ops = paddle_mobile::operators; + +#ifdef PADDLE_MOBILE_CL +REGISTER_OPERATOR_CL(flatten2, ops::Flatten2Op); +#endif + +#endif diff --git a/src/operators/flatten2_op.h b/src/operators/flatten2_op.h new file mode 100644 index 0000000000000000000000000000000000000000..9c08e9c3351381c8163f5e9dc90a00ec7ed50a56 --- /dev/null +++ b/src/operators/flatten2_op.h @@ -0,0 +1,34 @@ +/* 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 FLATTEN2_OP + +#pragma once + +#include +#include + +#include "framework/operator.h" +#include "operators/kernel/flatten2_kernel.h" +#include "operators/op_param.h" + +namespace paddle_mobile { +namespace operators { + +DECLARE_OPERATOR(Flatten2, FlattenParam, Flatten2Kernel); + +} // namespace operators +} // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/cl/cl_kernel/density_prior_box_kernel.cl b/src/operators/kernel/cl/cl_kernel/density_prior_box_kernel.cl new file mode 100644 index 0000000000000000000000000000000000000000..9d12c0c5f25de1d1f483c37b46c58fdb2fe14a3b --- /dev/null +++ b/src/operators/kernel/cl/cl_kernel/density_prior_box_kernel.cl @@ -0,0 +1,9 @@ + + + + + + +__kernel void density_prior_box(){ + +} \ No newline at end of file diff --git a/src/operators/kernel/cl/cl_kernel/flatten2_kernel.cl b/src/operators/kernel/cl/cl_kernel/flatten2_kernel.cl new file mode 100644 index 0000000000000000000000000000000000000000..c7b688d8ae8a3094b4915a800e2623e11ae651f9 --- /dev/null +++ b/src/operators/kernel/cl/cl_kernel/flatten2_kernel.cl @@ -0,0 +1,8 @@ + + + + + +__kernel void flatten2(){ + +} \ No newline at end of file diff --git a/src/operators/kernel/cl/density_prior_box_kernel.cpp b/src/operators/kernel/cl/density_prior_box_kernel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e182c0598cfc3041993678fd54beaea4736fc444 --- /dev/null +++ b/src/operators/kernel/cl/density_prior_box_kernel.cpp @@ -0,0 +1,39 @@ +/* Copyright (c) 2019 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 DENSITY_PRIORBOX_OP + +#include + +namespace paddle_mobile { +namespace operators { + +template <> +bool DensityPriorBoxKernel::Init( + paddle_mobile::operators::DensityPriorBoxParam + *param) { + this->cl_helper_.AddKernel("density_prior_box", + "density_prior_box_kernel.cl"); + return true; +} + +template <> +void DensityPriorBoxKernel::Compute( + const paddle_mobile::operators::DensityPriorBoxParam + ¶m) {} + +} // namespace operators +} // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/cl/flatten2_kernel.cpp b/src/operators/kernel/cl/flatten2_kernel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c1b60e673d7a8e5a2599494d2bb679fef71971e7 --- /dev/null +++ b/src/operators/kernel/cl/flatten2_kernel.cpp @@ -0,0 +1,37 @@ +/* Copyright (c) 2019 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 FLATTEN2_OP + +#include "operators/kernel/flatten2_kernel.h" + +namespace paddle_mobile { +namespace operators { + +template <> +bool Flatten2Kernel::Init( + paddle_mobile::operators::FlattenParam *param) { + this->cl_helper_.AddKernel("flatten2", "flatten2_kernel.cl"); + return true; +} + +template <> +void Flatten2Kernel::Compute( + const paddle_mobile::operators::FlattenParam + ¶m) {} + +} // namespace operators +} // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/flatten2_kernel.h b/src/operators/kernel/flatten2_kernel.h new file mode 100644 index 0000000000000000000000000000000000000000..78b3e820e63012139ef857d882b7b0855fe54035 --- /dev/null +++ b/src/operators/kernel/flatten2_kernel.h @@ -0,0 +1,28 @@ +/* Copyright (c) 2019 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. */ + +// +// Created by hujie09 on 2019-07-31. +// + +#ifdef FLATTEN2_OP +#include +#include "framework/operator.h" +namespace paddle_mobile { +namespace operators { +DECLARE_KERNEL(Flatten2, FlattenParam) +} +} // namespace paddle_mobile + +#endif // FLATTEN2_KERNEL diff --git a/src/operators/prior_box_op.cpp b/src/operators/prior_box_op.cpp index abef57e2bb3809ce280ebb9f1cfce8ef981e5bd5..da37273de5c45f5ab132ef1961fc7c7f71842ffd 100644 --- a/src/operators/prior_box_op.cpp +++ b/src/operators/prior_box_op.cpp @@ -95,4 +95,7 @@ REGISTER_OPERATOR_CPU(density_prior_box, ops::DensityPriorBoxOp); #ifdef PRIORBOX_OP REGISTER_OPERATOR_CL(prior_box, ops::PriorBoxOp); #endif // PRIORBOX_OP +#ifdef DENSITY_PRIORBOX_OP +REGISTER_OPERATOR_CL(density_prior_box, ops::DensityPriorBoxOp); +#endif // DENSITY_PRIORBOX_OP #endif // PADDLE_MOBILE_CL diff --git a/tools/op.cmake b/tools/op.cmake index b8ea4cb7b72efa7ab041a9c5cb87a452cffbb01a..eb23a5b39163cf452cc3503a95ee8169cd4c0c93 100755 --- a/tools/op.cmake +++ b/tools/op.cmake @@ -237,6 +237,7 @@ if (CON GREATER -1) set(BOXCODER_OP ON) set(MULTICLASSNMS_OP ON) set(FLATTEN_OP ON) + set(FLATTEN2_OP ON) set(SPLIT_OP ON) set(SHAPE_OP ON) @@ -328,6 +329,7 @@ if(NOT FOUND_MATCH) set(BILINEAR_INTERP_OP ON) set(SPLIT_OP ON) set(FLATTEN_OP ON) + set(FLATTEN2_OP ON) set(SHAPE_OP ON) set(ELEMENTWISEMUL_OP ON) set(SUM_OP ON) @@ -555,6 +557,10 @@ if (FLATTEN_OP) add_definitions(-DFLATTEN_OP) endif() +if (FLATTEN2_OP) + add_definitions(-DFLATTEN2_OP) +endif() + if (SPLIT_OP) add_definitions(-DSPLIT_OP) endif()