diff --git a/CMakeLists.txt b/CMakeLists.txt index cf754167480a99c1ed172c84afbe51e9ec36802a..5b6de21e060052f4cf9770a6ba7bde70196b5c0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.0) project(paddle-mobile) -#add_definitions(-DPADDLE_MOBILE_DEBUG) +add_definitions(-DPADDLE_MOBILE_DEBUG) add_definitions(-DENABLE_EXCEPTION) -add_definitions(-DARMV7) +#add_definitions(-DARMV7) #add_definitions(-DARMV8) #add_definitions(-DIOS) -#add_definitions(-DX86) +add_definitions(-DX86) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(CMAKE_BUILD_TYPE RelWithDebInfo) @@ -21,6 +21,75 @@ file(GLOB_RECURSE PADDLE_MOBILE_H src/*.h) include_directories(src/) +if (googlenet) + add_definitions(-DCONCAT_OP) + add_definitions(-DCONV_OP) + add_definitions(-DLRN_OP) + add_definitions(-DMUL_OP) + add_definitions(-DELEMENTWISEADD_OP) + add_definitions(-DFUSION_FC_OP) + add_definitions(-DPOOL_OP) + add_definitions(-DRELU_OP) +elseif (mobilenet) + add_definitions(-DCONV_OP) + add_definitions(-DELEMENTWISEADD_OP) + add_definitions(-DRELU_OP) + add_definitions(-DSOFTMAX_OP) + add_definitions(-DSOFTMAX_OP) + add_definitions(-DDEPTHWISECONV_OP) + add_definitions(-DBATCHNORM_OP) + add_definitions(-DPOOL_OP) + add_definitions(-DRESHAPE_OP) +elseif (yolo) + add_definitions(-DBATCHNORM_OP) + add_definitions(-DCONV_OP) + add_definitions(-DRELU_OP) + add_definitions(-DELEMENTWISEADD_OP) +elseif (squeezenet) + add_definitions(-DCONCAT_OP) + add_definitions(-DCONV_OP) + add_definitions(-DRELU_OP) + add_definitions(-DELEMENTWISEADD_OP) + add_definitions(-DPOOL_OP) + add_definitions(-DRESHAPE_OP) + add_definitions(-DSOFTMAX_OP) +elseif(resnet) + add_definitions(-DCONV_OP) + add_definitions(-DBATCHNORM_OP) + add_definitions(-DELEMENTWISEADD_OP) + add_definitions(-DSOFTMAX_OP) + add_definitions(-DMUL_OP) + add_definitions(-DPOOL_OP) + add_definitions(-DRELU_OP) +else () + add_definitions(-DBATCHNORM_OP) + add_definitions(-DBOXCODER_OP) + add_definitions(-DCONCAT_OP) + add_definitions(-DCONV_OP) + add_definitions(-DDEPTHWISECONV_OP) + add_definitions(-DELEMENTWISEADD_OP) + add_definitions(-DFUSIONCONVADD_OP) + add_definitions(-DCONVADDRELU_OP) + add_definitions(-DFUSION_FC_OP) + add_definitions(-DLRN_OP) + add_definitions(-DMUL_OP) + add_definitions(-DMULTICLASSNMS_OP) + add_definitions(-DPOOL_OP) + add_definitions(-DPRIORBOX_OP) + add_definitions(-DRELU_OP) + add_definitions(-DRESHAPE_OP) + add_definitions(-DSIGMOID_OP) + add_definitions(-DSOFTMAX_OP) + add_definitions(-DTRANSPOSE_OP) +endif() + add_library(paddle-mobile SHARED ${PADDLE_MOBILE_CC} ${PADDLE_MOBILE_H}) +if (googlenet) +elseif (mobilenet) +elseif (yolo) +elseif (squeezenet) +elseif(resnet) +else () +endif() add_subdirectory(test) diff --git a/src/common/enforce.h b/src/common/enforce.h index 52bda2258a00c7444762fe8297380c1c7752dd42..4b7c8dc0e267bc2862d2665e71085d679dceb1ff 100644 --- a/src/common/enforce.h +++ b/src/common/enforce.h @@ -18,7 +18,6 @@ limitations under the License. */ #include #include #include -#include #include #endif diff --git a/src/common/macros.h b/src/common/macros.h deleted file mode 100644 index ce133562cae0e4cd8720973c8f71ebca0e7e897d..0000000000000000000000000000000000000000 --- a/src/common/macros.h +++ /dev/null @@ -1,25 +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. */ - -#pragma once - -// Disable the copy and assignment operator for a class. -#ifndef DISABLE_COPY_AND_ASSIGN -#define DISABLE_COPY_AND_ASSIGN(classname) \ - private: \ - classname(const classname &) = delete; \ - classname(classname &&) = delete; \ - classname &operator=(const classname &) = delete; \ - classname &operator=(classname &&) = delete -#endif diff --git a/src/framework/dim.h b/src/framework/dim.h index 6740386c057d6e3a3466219170073cf65b29e03e..b84f6954932edff65da177307660bba7784b7e45 100644 --- a/src/framework/dim.h +++ b/src/framework/dim.h @@ -19,8 +19,6 @@ limitations under the License. */ #include #include -#include "platform/hostdevice.h" - namespace paddle_mobile { namespace framework { @@ -30,42 +28,35 @@ struct Dim { static constexpr int dimensions = i; template - HOSTDEVICE Dim(int64_t _head, Args... _tail) : head(_head), tail(_tail...) { + Dim(int64_t _head, Args... _tail) : head(_head), tail(_tail...) { static_assert(sizeof...(_tail) == i - 1, "Dim initialized with the wrong number of parameters"); } - HOSTDEVICE Dim(int64_t _head, const Dim &_tail) : head(_head), tail(_tail) {} - HOSTDEVICE Dim() : head(0), tail() {} /** Construct a Dim from a linear index and size. Uses Fortran * order * indexing. */ - HOSTDEVICE Dim(int64_t idx, const Dim &size) : head(idx % size.head), tail(idx / size.head, size.tail) {} /** Construct a Dim with each dimension set to the given index */ - HOSTDEVICE Dim(int64_t idx) : head(idx), tail(idx) {} - HOSTDEVICE bool operator==(const Dim &o) const { return (head == o.head) && (tail == o.tail); } - HOSTDEVICE bool operator!=(const Dim &o) const { return !(*this == o); } - HOSTDEVICE int64_t &operator[](int idx); - HOSTDEVICE + int64_t operator[](int idx) const; - HOST std::string to_string() const; + std::string to_string() const; int64_t head; Dim tail; @@ -76,13 +67,10 @@ template <> struct Dim<0> { static constexpr int dimensions = 0; - HOSTDEVICE Dim(int64_t _head) {} - HOSTDEVICE Dim() {} - HOSTDEVICE Dim(int idx, const Dim<0> &size) { #ifndef __CUDA_ARCH__ if (idx > 0) { @@ -93,15 +81,12 @@ struct Dim<0> { #endif } - HOSTDEVICE bool operator==(const Dim<0> &o) const { return true; } - HOSTDEVICE bool operator!=(const Dim<0> &o) const { return false; } - HOSTDEVICE int64_t &operator[](int idx); - HOSTDEVICE + int64_t operator[](int idx) const; }; @@ -112,12 +97,12 @@ template struct DimGetter { // Return a copy if Dim is const template - HOSTDEVICE static int64_t impl(const D &d) { + static int64_t impl(const D &d) { return DimGetter::impl(d.tail); } // Return a reference if Dim is mutable template - HOSTDEVICE static int64_t &impl(D &d) { + static int64_t &impl(D &d) { return DimGetter::impl(d.tail); } }; @@ -127,18 +112,18 @@ template <> struct DimGetter<0> { // Return a copy if Dim is const template - HOSTDEVICE static int64_t impl(const D &d) { + static int64_t impl(const D &d) { return d.head; } // Return a reference if Dim is mutable template - HOSTDEVICE static int64_t &impl(D &d) { + static int64_t &impl(D &d) { return d.head; } }; template -HOSTDEVICE int64_t &indexer(Dim &dim, int idx) { +int64_t &indexer(Dim &dim, int idx) { #ifndef __CUDA_ARCH__ if (idx < 0) { throw std::invalid_argument("Tried to access a negative dimension"); @@ -153,7 +138,7 @@ HOSTDEVICE int64_t &indexer(Dim &dim, int idx) { } template <> -HOSTDEVICE int64_t &indexer<0>(Dim<0> &dim, int idx) { +int64_t &indexer<0>(Dim<0> &dim, int idx) { #ifndef __CUDA_ARCH__ throw std::invalid_argument("Invalid index"); #else @@ -170,7 +155,7 @@ HOSTDEVICE int64_t &indexer<0>(Dim<0> &dim, int idx) { } template -HOSTDEVICE int64_t indexer(const Dim &dim, int idx) { +int64_t indexer(const Dim &dim, int idx) { #ifndef __CUDA_ARCH__ if (idx < 0) { throw std::invalid_argument("Tried to access a negative dimension"); @@ -185,7 +170,7 @@ HOSTDEVICE int64_t indexer(const Dim &dim, int idx) { } template <> -HOSTDEVICE int64_t indexer<0>(const Dim<0> &dim, int idx) { +int64_t indexer<0>(const Dim<0> &dim, int idx) { #ifndef __CUDA_ARCH__ throw std::invalid_argument("Invalid index"); #else @@ -204,83 +189,77 @@ HOSTDEVICE int64_t indexer<0>(const Dim<0> &dim, int idx) { } // namespace // Static access to constant Dim template -HOSTDEVICE int64_t get(const Dim &d) { +int64_t get(const Dim &d) { return DimGetter::impl(d); } // Static access to mutable Dim template -HOSTDEVICE int64_t &get(Dim &d) { +int64_t &get(Dim &d) { return DimGetter::impl(d); } // Dynamic access to constant Dim template -HOSTDEVICE int64_t Dim::operator[](int i) const { +int64_t Dim::operator[](int i) const { // std::cout << "l: " << l << std::endl; return indexer(*this, i); } // Dynamic access to mutable Dim template -HOSTDEVICE int64_t &Dim::operator[](int i) { +int64_t &Dim::operator[](int i) { return indexer(*this, i); } // Dynamic access to constant Dim -inline HOSTDEVICE int64_t Dim<0>::operator[](int i) const { - return indexer(*this, i); -} +inline int64_t Dim<0>::operator[](int i) const { return indexer(*this, i); } // Dynamic access to mutable Dim -inline HOSTDEVICE int64_t &Dim<0>::operator[](int i) { - return indexer(*this, i); -} +inline int64_t &Dim<0>::operator[](int i) { return indexer(*this, i); } // Dynamic access to constant Dim // without std::enable_if will try to instantiate this on get<0>(d) template -HOSTDEVICE typename std::enable_if<(l > 0), int64_t>::type get(const Dim &d, - int i) { +typename std::enable_if<(l > 0), int64_t>::type get(const Dim &d, int i) { return d[i]; } // Dynamic access to mutable Dim template -HOSTDEVICE typename std::enable_if<(l > 0), int64_t &>::type get(Dim &d, - int i) { +typename std::enable_if<(l > 0), int64_t &>::type get(Dim &d, int i) { return d[i]; } // Dot product of two dims template -HOSTDEVICE int64_t linearize(const Dim &a, const Dim &b) { +int64_t linearize(const Dim &a, const Dim &b) { return a.head * b.head + linearize(a.tail, b.tail); } // Base case dot product of two Dims // Notice it is inline because it is no longer a template template <> -HOSTDEVICE inline int64_t linearize(const Dim<0> &a, const Dim<0> &b) { +inline int64_t linearize(const Dim<0> &a, const Dim<0> &b) { return 0; } // Product of a Dim template -HOSTDEVICE int64_t product(const Dim &a, int prod = 1) { +int64_t product(const Dim &a, int prod = 1) { return prod * a.head * product(a.tail); } // Base case product of a Dim // Notice it is inline because it is no longer a template template <> -HOSTDEVICE inline int64_t product(const Dim<0> &a, int prod) { +inline int64_t product(const Dim<0> &a, int prod) { return prod; } // Is 0 <= idx_i < size_i for all i? template -HOSTDEVICE bool contained(const Dim &idx, const Dim &size) { +bool contained(const Dim &idx, const Dim &size) { return ((0 <= idx.head) && (idx.head < size.head) && contained(idx.tail, size.tail)); } @@ -288,7 +267,7 @@ HOSTDEVICE bool contained(const Dim &idx, const Dim &size) { // Base case of is 0 <= idx_i < size_i ? // Notice it is inline because it is no longer a template template <> -HOSTDEVICE inline bool contained(const Dim<0> &idx, const Dim<0> &size) { +inline bool contained(const Dim<0> &idx, const Dim<0> &size) { return true; } @@ -296,7 +275,7 @@ HOSTDEVICE inline bool contained(const Dim<0> &idx, const Dim<0> &size) { * \brief Compute exclusive prefix-multiply of a Dim. */ template -HOSTDEVICE Dim ex_prefix_mul(const Dim &src, int mul = 1) { +Dim ex_prefix_mul(const Dim &src, int mul = 1) { return Dim(mul, ex_prefix_mul(src.tail, mul * src.head)); } @@ -304,7 +283,7 @@ HOSTDEVICE Dim ex_prefix_mul(const Dim &src, int mul = 1) { // Base case of ex_prefix_mul // Notice it is inline because it is no longer a template template <> -HOSTDEVICE inline Dim<0> ex_prefix_mul(const Dim<0> &src, int mul) { +inline Dim<0> ex_prefix_mul(const Dim<0> &src, int mul) { return Dim<0>(); } ///\endcond @@ -313,18 +292,18 @@ HOSTDEVICE inline Dim<0> ex_prefix_mul(const Dim<0> &src, int mul) { * Add two dimensions together */ template -HOSTDEVICE Dim dim_plus(const Dim &a, const Dim &b) { +Dim dim_plus(const Dim &a, const Dim &b) { return Dim(a.head + b.head, dim_plus(a.tail, b.tail)); } // Base case template <> -HOSTDEVICE inline Dim<0> dim_plus(const Dim<0> &a, const Dim<0> &b) { +inline Dim<0> dim_plus(const Dim<0> &a, const Dim<0> &b) { return Dim<0>(); } template -HOSTDEVICE Dim operator+(const Dim &lhs, const Dim &rhs) { +Dim operator+(const Dim &lhs, const Dim &rhs) { return dim_plus(lhs, rhs); } @@ -332,18 +311,18 @@ HOSTDEVICE Dim operator+(const Dim &lhs, const Dim &rhs) { * Multiply two dimensions together */ template -HOSTDEVICE Dim dim_mult(const Dim &a, const Dim &b) { +Dim dim_mult(const Dim &a, const Dim &b) { return Dim(a.head * b.head, dim_mult(a.tail, b.tail)); } // Base case template <> -HOSTDEVICE inline Dim<0> dim_mult(const Dim<0> &a, const Dim<0> &b) { +inline Dim<0> dim_mult(const Dim<0> &a, const Dim<0> &b) { return Dim<0>(); } template -HOSTDEVICE Dim operator*(const Dim &lhs, const Dim &rhs) { +Dim operator*(const Dim &lhs, const Dim &rhs) { return dim_mult(lhs, rhs); } @@ -358,7 +337,7 @@ HOSTDEVICE Dim operator*(const Dim &lhs, const Dim &rhs) { */ template -HOSTDEVICE Dim normalize_strides(const Dim &size, const Dim &stride) { +Dim normalize_strides(const Dim &size, const Dim &stride) { int norm_stride = size.head == 1 ? 0 : stride.head; return Dim(norm_stride, normalize_strides(size.tail, stride.tail)); } @@ -366,8 +345,7 @@ HOSTDEVICE Dim normalize_strides(const Dim &size, const Dim &stride) { ///\cond HIDDEN template <> -HOSTDEVICE inline Dim<0> normalize_strides(const Dim<0> &size, - const Dim<0> &stride) { +inline Dim<0> normalize_strides(const Dim<0> &size, const Dim<0> &stride) { return Dim<0>(); } @@ -382,7 +360,7 @@ HOSTDEVICE inline Dim<0> normalize_strides(const Dim<0> &size, */ template -HOSTDEVICE Dim make_dim(Args... idxes) { +Dim make_dim(Args... idxes) { return Dim(idxes...); } @@ -409,7 +387,7 @@ inline std::ostream &operator<<(std::ostream &os, const Dim<0> &d) { } template -HOST std::string Dim::to_string() const { +std::string Dim::to_string() const { std::stringstream stream; stream << *this; @@ -418,7 +396,7 @@ HOST std::string Dim::to_string() const { } template -HOSTDEVICE Dim linear_to_dimension(int linear_index, Dim extents) { +Dim linear_to_dimension(int linear_index, Dim extents) { Dim result; for (int i = 0; i < D - 1; ++i) { diff --git a/src/framework/program/program-optimize/node.cpp b/src/framework/program/program-optimize/node.cpp index eba5e8b6504e04ec3f9d0d235cc04efd4937baae..ed49c541110e9f38ad76cbfa3ee58b6f3a7e784b 100644 --- a/src/framework/program/program-optimize/node.cpp +++ b/src/framework/program/program-optimize/node.cpp @@ -12,10 +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. */ -#include - -#include "framework/operator.h" #include "framework/program/program-optimize/node.h" +#include "framework/operator.h" namespace paddle_mobile { diff --git a/src/framework/tensor_util.cpp b/src/framework/tensor_util.cpp index 23b775b095d04c46764791f9f8438f2b888263bd..1b0cc002bfeb9ea5cebdd4efd6c2da77cc971dfe 100644 --- a/src/framework/tensor_util.cpp +++ b/src/framework/tensor_util.cpp @@ -39,9 +39,6 @@ void TensorCopy(const Tensor &src, Tensor *dst) { } void TensorCopySync(const Tensor &src, Tensor *dst) { - // VLOG(3) << "TensorCopySync " << src.dims() << " from " << - // src.place() - // << " to " << dst_place; src.check_memory_size(); dst->Resize(src.dims()); dst->set_layout(src.layout()); @@ -69,41 +66,6 @@ struct AnyDTypeVisitor { } }; -template -inline void AnyImpl(Predicate predicate, const Tensor &tensor, - framework::Tensor *out) { - VisitDataType(ToDataType(tensor.type()), - AnyDTypeVisitor(predicate, tensor, out)); -} - -template -struct AnyVisitor { - const framework::Tensor &tensor_; - Predicate predicate_; - - AnyVisitor(const framework::Tensor &tensor, Predicate predicate) - : tensor_(tensor), predicate_(std::move(predicate)) {} - - bool operator()(void) const { - framework::Tensor out; - out.Resize({1}); - out.mutable_data(); - AnyImpl(predicate_, tensor_, &out); - return this->GetResult(out); - } - - bool GetResult(const framework::Tensor &out) const { - return *out.data(); - } -}; - -template -inline bool Any(const framework::Tensor &tensor, Predicate predicate) { - AnyVisitor visitor(tensor, predicate); - // return platform::VisitPlace(visitor); - return visitor(); -} - struct ContainsNANPredicate { template auto operator()(const T &eigen_vec) const @@ -113,11 +75,6 @@ struct ContainsNANPredicate { } }; -bool TensorContainsNAN(const framework::Tensor &tensor) { - ContainsNANPredicate predicate; - return Any(tensor, predicate); -} - struct ContainsInfPredicate { template auto operator()(const T &eigen_vec) const @@ -127,11 +84,6 @@ struct ContainsInfPredicate { } }; -bool TensorContainsInf(const framework::Tensor &tensor) { - ContainsInfPredicate predicate; - return Any(tensor, predicate); -} - struct DeserializedDataFunctor { DeserializedDataFunctor(void **buf, Tensor *tensor) : buf_(buf), tensor_(tensor) {} diff --git a/src/framework/tensor_util.h b/src/framework/tensor_util.h index 9af873d34a914b966a20c79a9c8f815309cba680..898482fee8d69edd8e8fce284398ed91bd86cd90 100644 --- a/src/framework/tensor_util.h +++ b/src/framework/tensor_util.h @@ -15,7 +15,6 @@ limitations under the License. */ #pragma once #include #include "memory/t_malloc.h" -#include "platform/data_type.h" #include "tensor.h" namespace paddle_mobile { diff --git a/src/io.h b/src/io.h index 13a6761b81c2679afc02d220c11056584f84f5dd..ff704b3b459d92a4d97e36bc8f52ebf31849735e 100644 --- a/src/io.h +++ b/src/io.h @@ -14,8 +14,8 @@ limitations under the License. */ #pragma once -#include #include +#include #include #include @@ -27,7 +27,7 @@ limitations under the License. */ namespace paddle_mobile { -template +template class Loader { public: const framework::Program Load(const std::string &dirname, @@ -39,7 +39,7 @@ class Loader { const std::string &file_path); }; -template +template class Executor { public: typedef typename PrecisionTrait

::ptype Ptype; diff --git a/src/operators/batchnorm_op.cpp b/src/operators/batchnorm_op.cpp index 1f8a1698f4281174d2503650bde5deb0ef9825e9..815eac8806c82c2a167fc7c462d2e76f1bb233fd 100644 --- a/src/operators/batchnorm_op.cpp +++ b/src/operators/batchnorm_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 BATCHNORM_OP + #include "batchnorm_op.h" namespace paddle_mobile { @@ -29,3 +31,5 @@ template class BatchNormOp; namespace ops = paddle_mobile::operators; USE_OP(batch_norm); REGISTER_OPERATOR(batch_norm, ops::BatchNormOp); + +#endif diff --git a/src/operators/batchnorm_op.h b/src/operators/batchnorm_op.h index 760466eeddcb472ed2a47625b786a021ce7c1ef5..671b2f09f6cbc47570493a8bf1d2c4e23dde9f8b 100644 --- a/src/operators/batchnorm_op.h +++ b/src/operators/batchnorm_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 BATCHNORM_OP + #pragma once #include @@ -47,3 +49,5 @@ class BatchNormOp : public framework::OperatorWithKernel { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/box_coder_op.cpp b/src/operators/box_coder_op.cpp index ca653b5711241e77a9df308922aedb0551b1103f..22d006a258ca0cd18b63dc72aed6a02405ff6e81 100644 --- a/src/operators/box_coder_op.cpp +++ b/src/operators/box_coder_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 BOXCODER_OP + #include "operators/box_coder_op.h" #include namespace paddle_mobile { @@ -52,3 +54,5 @@ template class BoxCoderOp; namespace ops = paddle_mobile::operators; USE_OP(box_coder); REGISTER_OPERATOR(box_coder, ops::BoxCoderOp); + +#endif diff --git a/src/operators/box_coder_op.h b/src/operators/box_coder_op.h index a2203e1d89f8b5b6270c1576711a4c008d927e34..2d3cd0d8eaa21df3384a22e0659b10c3eac394a3 100644 --- a/src/operators/box_coder_op.h +++ b/src/operators/box_coder_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 BOXCODER_OP + #pragma once #include @@ -50,3 +52,5 @@ class BoxCoderOp : public framework::OperatorWithKernel { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/concat_op.cpp b/src/operators/concat_op.cpp index 6744b47b7728558f95fad0435979841a73a7a6f6..26f5e7d4e48ee2c3402a821b49757b1b0914828a 100644 --- a/src/operators/concat_op.cpp +++ b/src/operators/concat_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 CONCAT_OP + #include "concat_op.h" namespace paddle_mobile { @@ -62,3 +64,5 @@ template class ConcatOp; namespace ops = paddle_mobile::operators; USE_OP(concat); REGISTER_OPERATOR(concat, ops::ConcatOp); + +#endif diff --git a/src/operators/concat_op.h b/src/operators/concat_op.h index 15160e20a403d73bb11e982f5a527454f26b5dd6..ad2db52a0b65a8474a2534d592b7bbd53924f8cf 100644 --- a/src/operators/concat_op.h +++ b/src/operators/concat_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 CONCAT_OP + #pragma once #include @@ -45,3 +47,5 @@ class ConcatOp : public framework::OperatorWithKernel { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/conv_op.cpp b/src/operators/conv_op.cpp index f9576f2598ce08f4f4f37997f2c847399096b796..c8ec33333f596a6c10491cfdb826f1dc54d69c6f 100644 --- a/src/operators/conv_op.cpp +++ b/src/operators/conv_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 CONV_OP + #include "operators/conv_op.h" #include #include "framework/op_proto_maker.h" @@ -53,3 +55,5 @@ template class ConvOp; namespace ops = paddle_mobile::operators; USE_OP(conv2d); REGISTER_OPERATOR(conv2d, ops::ConvOp); + +#endif diff --git a/src/operators/conv_op.h b/src/operators/conv_op.h index f15f286b606db1403b0e0e609bfc38caac2c5105..0a26ce6c3f1ee005e982f10dcc3b38853124bdfb 100644 --- a/src/operators/conv_op.h +++ b/src/operators/conv_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 CONV_OP + #pragma once #include @@ -53,3 +55,5 @@ inline int ConvOutputSize(int input_size, int filter_size, int dilation, } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/depthwise_conv_op.cpp b/src/operators/depthwise_conv_op.cpp index 3e3e510d76e107885170223fa971a6a09e826e78..87c9746b4dfa1e74fcf3733656b9b3b27a8740fb 100644 --- a/src/operators/depthwise_conv_op.cpp +++ b/src/operators/depthwise_conv_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 DEPTHWISECONV_OP + #include "operators/depthwise_conv_op.h" #include #include "framework/op_proto_maker.h" @@ -54,3 +56,5 @@ template class DepthwiseConvOp; namespace ops = paddle_mobile::operators; USE_OP(depthwise_conv2d); REGISTER_OPERATOR(depthwise_conv2d, ops::DepthwiseConvOp); + +#endif diff --git a/src/operators/depthwise_conv_op.h b/src/operators/depthwise_conv_op.h index c47fa0ffcacd54a5ddf7280419ca1170173bde1b..37ba1b9ada32d75cb715dd86221758c71c6b1929 100644 --- a/src/operators/depthwise_conv_op.h +++ b/src/operators/depthwise_conv_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 DEPTHWISECONV_OP + #pragma once #include @@ -47,3 +49,5 @@ class DepthwiseConvOp : public framework::OperatorWithKernel { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/elementwise_add_op.cpp b/src/operators/elementwise_add_op.cpp index 1eff80152bfb193fc8cd3866d63b1ae4d55f4b9c..ff2cd2598814cf9a270090213c0524c165c66ced 100644 --- a/src/operators/elementwise_add_op.cpp +++ b/src/operators/elementwise_add_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 ELEMENTWISEADD_OP + #include "elementwise_add_op.h" namespace paddle_mobile { @@ -29,3 +31,5 @@ template class ElementwiseAddOp; namespace ops = paddle_mobile::operators; USE_OP(elementwise_add); REGISTER_OPERATOR(elementwise_add, ops::ElementwiseAddOp); + +#endif diff --git a/src/operators/elementwise_add_op.h b/src/operators/elementwise_add_op.h index 7dd7e147a0630450c3ad9f830d661b2b92a5f995..727d569fb3eada6b406c02f127c04022eab4ac2d 100644 --- a/src/operators/elementwise_add_op.h +++ b/src/operators/elementwise_add_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 ELEMENTWISEADD_OP + #pragma once #include @@ -46,3 +48,5 @@ class ElementwiseAddOp : public framework::OperatorWithKernel { }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/fusion_conv_add.cpp b/src/operators/fusion_conv_add.cpp index 433e3ee741d37fefead87fc6d08723fde8142387..fe380bddca585e434418513d5152c1df0426e80d 100644 --- a/src/operators/fusion_conv_add.cpp +++ b/src/operators/fusion_conv_add.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 FUSIONCONVADD_OP + #include "operators/fusion_conv_add.h" namespace paddle_mobile { namespace operators { @@ -25,3 +27,5 @@ template class FushionConvAddOp; namespace ops = paddle_mobile::operators; USE_OP(conv_add); REGISTER_OPERATOR(conv_add, ops::FushionConvAddOp); + +#endif diff --git a/src/operators/fusion_conv_add.h b/src/operators/fusion_conv_add.h index c6a1d9fdff246084542d50230a7649e938143c4a..911df63dd4e2a5c00ac364d85dd4916afb72e627 100644 --- a/src/operators/fusion_conv_add.h +++ b/src/operators/fusion_conv_add.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 FUSIONCONVADD_OP + #pragma once #include @@ -66,3 +68,5 @@ class FushionConvAddOp : public framework::OperatorWithKernel { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/fusion_conv_add_relu_op.cpp b/src/operators/fusion_conv_add_relu_op.cpp index 92f6fcf848f169eed141b1456c05e6fbd8ca9895..bf33db7d78e995c087478f947ece7038953fa42f 100644 --- a/src/operators/fusion_conv_add_relu_op.cpp +++ b/src/operators/fusion_conv_add_relu_op.cpp @@ -12,4 +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 CONVADDRELU_OP + #include "fusion_conv_add_relu_op.h" + +#endif diff --git a/src/operators/fusion_conv_add_relu_op.h b/src/operators/fusion_conv_add_relu_op.h index 43279e1f995f4b18ca976e51d1a4f81847c975b9..4825a01be95f31d11418fe114700aaaa248e0d7e 100644 --- a/src/operators/fusion_conv_add_relu_op.h +++ b/src/operators/fusion_conv_add_relu_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 CONVADDRELU_OP + #pragma once #include "framework/operator.h" @@ -49,3 +51,5 @@ class ConvAddReluOp { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/fusion_fc_op.cpp b/src/operators/fusion_fc_op.cpp index 0f1be5c29fee1f741b773bbfa11b50b5aa49b8b7..8f639e212a1a922fb1a943d2582dd692e1bfabee 100644 --- a/src/operators/fusion_fc_op.cpp +++ b/src/operators/fusion_fc_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 FUSION_FC_OP + #include "operators/fusion_fc_op.h" namespace paddle_mobile { namespace operators { @@ -54,3 +56,5 @@ template class FushionFcOp; namespace ops = paddle_mobile::operators; USE_OP(fc); REGISTER_OPERATOR(fc, ops::FushionFcOp); + +#endif diff --git a/src/operators/fusion_fc_op.h b/src/operators/fusion_fc_op.h index a0eeebca5f5f028bec75703a4a4befeb18e374fe..c5419de9ff36898283c3743908b017e01c4c913c 100644 --- a/src/operators/fusion_fc_op.h +++ b/src/operators/fusion_fc_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 FUSION_FC_OP + #pragma once #include @@ -71,3 +73,5 @@ class FushionFcOp : public framework::OperatorWithKernel { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/batchnorm_kernel.cpp b/src/operators/kernel/arm/batchnorm_kernel.cpp index e28bdd7147f300cb181ffc5e0aeebec412ec45e7..e441e6cf3816ee5a5d21b5fcd1d1dc02d59ae39d 100644 --- a/src/operators/kernel/arm/batchnorm_kernel.cpp +++ b/src/operators/kernel/arm/batchnorm_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 BATCHNORM_OP + #pragma once #include "operators/kernel/batchnorm_kernel.h" @@ -91,3 +93,5 @@ void BatchNormKernel::Compute(const BatchNormParam ¶m) const { } } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/box_coder_kernel.cpp b/src/operators/kernel/arm/box_coder_kernel.cpp index d604c3d2a8d7f7fb1c817397a61cb156f1d0f392..9654228911af77e751e4ef9d1b92fb92ae30591d 100644 --- a/src/operators/kernel/arm/box_coder_kernel.cpp +++ b/src/operators/kernel/arm/box_coder_kernel.cpp @@ -12,7 +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. */ -#pragma once +#ifdef BOXCODER_OP #include "operators/kernel/box_coder_kernel.h" @@ -135,3 +135,5 @@ void BoxCoderKernel::Compute(const BoxCoderParam& param) const { } } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/concat_kernel.cpp b/src/operators/kernel/arm/concat_kernel.cpp index 705b698dbe9e9768713417f85ae2879df66acf9e..329677fb11e6ee2db74b5191586ac6157ede9697 100644 --- a/src/operators/kernel/arm/concat_kernel.cpp +++ b/src/operators/kernel/arm/concat_kernel.cpp @@ -12,7 +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. */ -#pragma once +#ifdef CONCAT_OP #include "operators/kernel/concat_kernel.h" @@ -85,3 +85,5 @@ void ConcatKernel::Compute(const ConcatParam ¶m) const { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/conv_kernel.cpp b/src/operators/kernel/arm/conv_kernel.cpp index f04b8156c9d3c88520b1c74b60a20f41e7fedc98..546ae33407d4c5affd6459d4167ba5b373887f12 100644 --- a/src/operators/kernel/arm/conv_kernel.cpp +++ b/src/operators/kernel/arm/conv_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 CONV_OP + #include "operators/kernel/conv_kernel.h" namespace paddle_mobile { @@ -112,3 +114,5 @@ template class ConvKernel; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/depthwise_conv_kernel.cpp b/src/operators/kernel/arm/depthwise_conv_kernel.cpp index 1da52fa8d469bd81d043843d7bcca3a7b01f6663..6cd4538c4540ff11d91a6f49d088ad38f6d992e7 100644 --- a/src/operators/kernel/arm/depthwise_conv_kernel.cpp +++ b/src/operators/kernel/arm/depthwise_conv_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 DEPTHWISECONV_OP + #include "operators/kernel/depthwise_conv_kernel.h" #include "operators/kernel/conv_kernel.h" @@ -124,3 +126,5 @@ template class DepthwiseConvKernel; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/elementwise_add_kernel.cpp b/src/operators/kernel/arm/elementwise_add_kernel.cpp index f8d40ad17ff09d77c26a9f32a87190f1cdd6038a..02aabfe3ce0622df80c86906f45ab5cc688c7b12 100644 --- a/src/operators/kernel/arm/elementwise_add_kernel.cpp +++ b/src/operators/kernel/arm/elementwise_add_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 ELEMENTWISEADD_OP + #pragma once #include "operators/kernel/elementwise_add_kernel.h" @@ -40,3 +42,5 @@ template class ElementwiseAddKernel; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/fushion_fc_kernel.cpp b/src/operators/kernel/arm/fushion_fc_kernel.cpp index ebec90aa27154334488329d079b76d14630e3294..ea88252c21ab2f13f0564602ac9b922be521578b 100644 --- a/src/operators/kernel/arm/fushion_fc_kernel.cpp +++ b/src/operators/kernel/arm/fushion_fc_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 FUSION_FC_OP + #pragma once #include "operators/kernel/fushion_fc_kernel.h" @@ -65,3 +67,5 @@ void FushionFcKernel::Compute(const FushionFcParam ¶m) const { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/lrn_kernel.cpp b/src/operators/kernel/arm/lrn_kernel.cpp index 47e64d487d72eb191e6b0ec8751c877363dd7b48..3e12b62508204b38150d7fcc82cef99f7617ba09 100644 --- a/src/operators/kernel/arm/lrn_kernel.cpp +++ b/src/operators/kernel/arm/lrn_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 LRN_OP + #pragma once #include "operators/kernel/lrn_kernel.h" @@ -42,3 +44,5 @@ template class LrnKernel; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/mul_kernel.cpp b/src/operators/kernel/arm/mul_kernel.cpp index f1eea3950cebe8d4c27b3481bf527e75f26c99aa..70bcac2461cdef535de8c9759ec10113e45b7ae2 100644 --- a/src/operators/kernel/arm/mul_kernel.cpp +++ b/src/operators/kernel/arm/mul_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 MUL_OP + #pragma once #include "operators/kernel/mul_kernel.h" @@ -48,3 +50,5 @@ template class MulKernel; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/multiclass_nms_kernel.cpp b/src/operators/kernel/arm/multiclass_nms_kernel.cpp index 61470ee31936f092e2f534c5534c1c78aaf5d44c..39f55dab38031db14b617e48eedb236eacd1b714 100644 --- a/src/operators/kernel/arm/multiclass_nms_kernel.cpp +++ b/src/operators/kernel/arm/multiclass_nms_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 MULTICLASSNMS_OP + #pragma once #include "operators/kernel/multiclass_nms_kernel.h" @@ -273,3 +275,5 @@ void MultiClassNMSKernel::Compute( } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/pool_kernel.cpp b/src/operators/kernel/arm/pool_kernel.cpp index 6aa1b76058fdf8a9828321a23f26b1c17134d7c9..2809a802a6cf94c931e409aecfa0090139624a46 100644 --- a/src/operators/kernel/arm/pool_kernel.cpp +++ b/src/operators/kernel/arm/pool_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 POOL_OP + #include #include "common/log.h" @@ -73,3 +75,5 @@ void PoolKernel::Compute(const PoolParam ¶m) const { } } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/prior_box_kernel.cpp b/src/operators/kernel/arm/prior_box_kernel.cpp index fc61f43f3fe363c1f6d67f81ef37fb2d950f9717..e029c555d4d40745976be45b7a9c022eb62705c7 100644 --- a/src/operators/kernel/arm/prior_box_kernel.cpp +++ b/src/operators/kernel/arm/prior_box_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 PRIORBOX_OP + #pragma once #include "operators/kernel/prior_box_kernel.h" @@ -143,3 +145,5 @@ void PriorBoxKernel::Compute(const PriorBoxParam ¶m) const { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/relu_kernel.cpp b/src/operators/kernel/arm/relu_kernel.cpp index 586d981175184e2da03f2949390932b888d67f4a..854fa1d185ddb002aa37a10ade0683d841af8793 100644 --- a/src/operators/kernel/arm/relu_kernel.cpp +++ b/src/operators/kernel/arm/relu_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 RELU_OP + #pragma once #include "operators/kernel/relu_kernel.h" @@ -45,3 +47,5 @@ void ReluKernel::Compute(const ReluParam ¶m) const { } } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/reshape_kernel.cpp b/src/operators/kernel/arm/reshape_kernel.cpp index 7f7e80ece9f30631c109d0d27f4025e2617cec95..3d40309e97145e1df70f2a4191ee571c4a05627a 100644 --- a/src/operators/kernel/arm/reshape_kernel.cpp +++ b/src/operators/kernel/arm/reshape_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 RESHAPE_OP + #pragma once #include "operators/kernel/reshape_kernel.h" @@ -49,3 +51,5 @@ void ReshapeKernel::Compute(const ReshapeParam ¶m) const { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/sigmoid_kernel.cpp b/src/operators/kernel/arm/sigmoid_kernel.cpp index 9f0886d58288e7333cbd27e24f82af3d2403b982..c03a8644cc086e14a24abd32bf2bdb347187ce0e 100644 --- a/src/operators/kernel/arm/sigmoid_kernel.cpp +++ b/src/operators/kernel/arm/sigmoid_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 SIGMOID_OP + #include "../sigmoid_kernel.h" #if __ARM_NEON #include "../../math/math_func_neon.h" @@ -79,3 +81,5 @@ void SigmoidKernel::Compute(const SigmoidParam ¶m) const { template class SigmoidKernel; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/softmax_kernel.cpp b/src/operators/kernel/arm/softmax_kernel.cpp index 0a50fc0a0136b66df4f55c10decc84a541b52dce..542283242d09abfbad8830eb0b36136ed35a6ef6 100644 --- a/src/operators/kernel/arm/softmax_kernel.cpp +++ b/src/operators/kernel/arm/softmax_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 SOFTMAX_OP + #include "../softmax_kernel.h" #include "../../math/softmax.h" namespace paddle_mobile { @@ -29,3 +31,5 @@ void SoftmaxKernel::Compute(const SoftmaxParam ¶m) const { template class SoftmaxKernel; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/arm/transpose_kernel.cpp b/src/operators/kernel/arm/transpose_kernel.cpp index 92b5916ec40d53bb55c1cc4aaf0ce6ec9a9bfaeb..3ebe261fb8fe511022d6efbf4641898ef326319f 100644 --- a/src/operators/kernel/arm/transpose_kernel.cpp +++ b/src/operators/kernel/arm/transpose_kernel.cpp @@ -12,7 +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. */ -#pragma once +#ifdef TRANSPOSE_OP #include "operators/kernel/transpose_kernel.h" @@ -70,3 +70,5 @@ void TransposeKernel::Compute(const TransposeParam& param) const { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/batchnorm_kernel.h b/src/operators/kernel/batchnorm_kernel.h index ebace43e1c559df1bf997d05f68db862d1ed3cb4..6c795b2d5e9e7e81fb25d4a1a6dd3ca13c04bd9b 100644 --- a/src/operators/kernel/batchnorm_kernel.h +++ b/src/operators/kernel/batchnorm_kernel.h @@ -12,9 +12,12 @@ 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 BATCHNORM_OP + +#pragma once + #include "framework/operator.h" #include "operators/op_param.h" -#pragma once; namespace paddle_mobile { namespace operators { @@ -30,3 +33,5 @@ class BatchNormKernel } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/box_coder_kernel.h b/src/operators/kernel/box_coder_kernel.h index 2d350202d091563f668f9209a1540bb0a32b6ac3..1c612b373cd086fcd566fe69e71eb77e4d1a30b6 100644 --- a/src/operators/kernel/box_coder_kernel.h +++ b/src/operators/kernel/box_coder_kernel.h @@ -12,14 +12,16 @@ 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 BOXCODER_OP + +#pragma once + #include #include "framework/operator.h" #include "operators/math/transform.h" #include "operators/op_param.h" -#pragma once; - namespace paddle_mobile { namespace operators { @@ -31,3 +33,5 @@ class BoxCoderKernel }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/concat_kernel.h b/src/operators/kernel/concat_kernel.h index d91fb84f015851074e317980f1fe9ff930e9e399..3b649974e8bb670b7ec81c61f185a2d8f9b24ad0 100644 --- a/src/operators/kernel/concat_kernel.h +++ b/src/operators/kernel/concat_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 CONCAT_OP + #pragma once #include "framework/operator.h" #include "operators/op_param.h" @@ -29,3 +31,5 @@ class ConcatKernel : public framework::OpKernelBase { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/conv_kernel.h b/src/operators/kernel/conv_kernel.h index d43a174ffdbf0ca6dbb39e463b8e97652c7b0daf..06c0c2c55629d9762cffa0b2c5572050b95bc771 100644 --- a/src/operators/kernel/conv_kernel.h +++ b/src/operators/kernel/conv_kernel.h @@ -12,6 +12,10 @@ 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 CONV_OP + +#pragma once + #include #include "framework/operator.h" #include "operators/math/im2col.h" @@ -19,8 +23,6 @@ limitations under the License. */ #include "operators/math/vol2col.h" #include "operators/op_param.h" -#pragma once; - namespace paddle_mobile { namespace operators { @@ -49,3 +51,5 @@ inline bool IsExpand(const std::vector &filter_dim, } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/depthwise_conv_kernel.h b/src/operators/kernel/depthwise_conv_kernel.h index 43ddfb25cd859a7e937577221215d8352b846bff..1ef76a573e27ff09fe7842ad78e9fe6042a742a1 100644 --- a/src/operators/kernel/depthwise_conv_kernel.h +++ b/src/operators/kernel/depthwise_conv_kernel.h @@ -12,14 +12,16 @@ 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 DEPTHWISECONV_OP + +#pragma once + #include "framework/operator.h" #include "operators/math/im2col.h" #include "operators/math/math_function.h" #include "operators/math/vol2col.h" #include "operators/op_param.h" -#pragma once; - namespace paddle_mobile { namespace operators { @@ -32,3 +34,5 @@ class DepthwiseConvKernel : public OpKernelBase { }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/elementwise_add_kernel.h b/src/operators/kernel/elementwise_add_kernel.h index 28b3bc29e593561d18512cbf1af947dd64cd9d87..7a2f92120105b9f9539937e00c392c0eb77e3830 100644 --- a/src/operators/kernel/elementwise_add_kernel.h +++ b/src/operators/kernel/elementwise_add_kernel.h @@ -12,7 +12,9 @@ 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. */ -#pragma once; +#ifdef ELEMENTWISEADD_OP + +#pragma once #include "framework/operator.h" #include "operators/math/elementwise_op_function.h" @@ -31,3 +33,5 @@ class ElementwiseAddKernel }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/fpga/conv_kernel.cpp b/src/operators/kernel/fpga/conv_kernel.cpp index a50a5c59bdaaa3829602049bf88bf41fa02af53c..21badb0d8eaf125a6e46bf3283adca90a175b984 100644 --- a/src/operators/kernel/fpga/conv_kernel.cpp +++ b/src/operators/kernel/fpga/conv_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 CONV_OP + namespace paddle_mobile { namespace operators { @@ -22,3 +24,5 @@ namespace operators { // template class ConvKernel; } } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/fushion_fc_kernel.h b/src/operators/kernel/fushion_fc_kernel.h index 7597a7120d1840128810730ad3fab11fd01b10fa..aff8917664341d980fca67f846aa7e2926bdd534 100644 --- a/src/operators/kernel/fushion_fc_kernel.h +++ b/src/operators/kernel/fushion_fc_kernel.h @@ -12,12 +12,14 @@ 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 FUSION_FC_OP + +#pragma once + #include "framework/operator.h" #include "operators/math/math_function.h" #include "operators/op_param.h" -#pragma once; - namespace paddle_mobile { namespace operators { @@ -29,3 +31,5 @@ class FushionFcKernel }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/lrn_kernel.h b/src/operators/kernel/lrn_kernel.h index f5fd8313482a92aad0c01d3e0acc9dcfcc83f2d8..ca04a45572bd922baa936bc151f7730c16131f40 100644 --- a/src/operators/kernel/lrn_kernel.h +++ b/src/operators/kernel/lrn_kernel.h @@ -12,9 +12,12 @@ 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 LRN_OP + +#pragma once + #include "framework/operator.h" #include "operators/op_param.h" -#pragma once; namespace paddle_mobile { namespace operators { @@ -70,3 +73,5 @@ class LrnKernel : public framework::OpKernelBase { }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/mali/conv_kernel.cpp b/src/operators/kernel/mali/conv_kernel.cpp index 75672549583ebc15867e5f279d5ce3a7137e5b70..695f937880328e8c2ffed91a8beee23e9a72899a 100644 --- a/src/operators/kernel/mali/conv_kernel.cpp +++ b/src/operators/kernel/mali/conv_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 CONV_OP + #include "operators/kernel/conv_kernel.h" namespace paddle_mobile { @@ -23,3 +25,5 @@ void ConvKernel::Compute(const ConvParam ¶m) const {} template class ConvKernel; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/mul_kernel.h b/src/operators/kernel/mul_kernel.h index 809c9b80b5ba0d610827d8fa5ff00d5ad7183ab9..4ca1df1af188b4e9b95644d0796a7968f873f6f4 100644 --- a/src/operators/kernel/mul_kernel.h +++ b/src/operators/kernel/mul_kernel.h @@ -12,10 +12,13 @@ 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 MUL_OP + +#pragma once + #include "framework/operator.h" #include "operators/math/math_function.h" #include "operators/op_param.h" -#pragma once; namespace paddle_mobile { namespace operators { @@ -29,3 +32,5 @@ class MulKernel : public framework::OpKernelBase { }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/multiclass_nms_kernel.h b/src/operators/kernel/multiclass_nms_kernel.h index 4453197e5c866398bc6f8807ec921ff5638fbb71..82bafe2685423f8014d95b8fc875554567d2094a 100644 --- a/src/operators/kernel/multiclass_nms_kernel.h +++ b/src/operators/kernel/multiclass_nms_kernel.h @@ -12,10 +12,13 @@ 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 MULTICLASSNMS_OP + +#pragma once + #include "framework/operator.h" -#include "operators/op_param.h" -#pragma once; +#include "operators/op_param.h" namespace paddle_mobile { namespace operators { @@ -28,3 +31,5 @@ class MultiClassNMSKernel }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/pool_kernel.h b/src/operators/kernel/pool_kernel.h index 5cb185dea6eaed0bbb50c5fd5d3450d4e92f18e7..2a7b0ec48edeb922d6701e6ce4a9b6a514bc58f7 100644 --- a/src/operators/kernel/pool_kernel.h +++ b/src/operators/kernel/pool_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 POOL_OP + #pragma once #include "framework/operator.h" @@ -29,3 +31,5 @@ class PoolKernel : public OpKernelBase { }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/prior_box_kernel.h b/src/operators/kernel/prior_box_kernel.h index c3cd399bfe9fad86b45c33d947dbbb3e4f99bade..3e7c72a736ea56beb6cede1d5892675d6721163f 100644 --- a/src/operators/kernel/prior_box_kernel.h +++ b/src/operators/kernel/prior_box_kernel.h @@ -12,14 +12,16 @@ 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 PRIORBOX_OP + +#pragma once + #include #include "framework/operator.h" #include "operators/math/transform.h" #include "operators/op_param.h" -#pragma once; - namespace paddle_mobile { namespace operators { @@ -55,3 +57,5 @@ class PriorBoxKernel }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/relu_kernel.h b/src/operators/kernel/relu_kernel.h index 83b4548f3e5421657ae6f79bd226e16e1aba7ffb..793268f35a78255f853c85d1af0d2ef0d3d328e5 100644 --- a/src/operators/kernel/relu_kernel.h +++ b/src/operators/kernel/relu_kernel.h @@ -12,10 +12,13 @@ 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 "framework/operator.h" -#include "operators/op_param.h" -#pragma once; +#include "operators/op_param.h" namespace paddle_mobile { namespace operators { @@ -27,3 +30,5 @@ class ReluKernel : public framework::OpKernelBase { }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/reshape_kernel.h b/src/operators/kernel/reshape_kernel.h index 7d5dcdf71de232b1c72180231731fcf76483b9e4..6b153e5fe3eba73f548fd1fc0ab9f95a5b390bf1 100644 --- a/src/operators/kernel/reshape_kernel.h +++ b/src/operators/kernel/reshape_kernel.h @@ -12,12 +12,14 @@ 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 +#ifdef RESHAPE_OP + +#pragma once +#include #include "framework/operator.h" -#include "operators/op_param.h" -#pragma once; +#include "operators/op_param.h" namespace paddle_mobile { namespace operators { @@ -72,3 +74,5 @@ class ReshapeKernel : public framework::OpKernelBase { }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/sigmoid_kernel.h b/src/operators/kernel/sigmoid_kernel.h index 8f5c787f3ff009ed1e334e61657d00454d6e4c0b..e901f02096c764537f268f628ccdc379f3a503e1 100644 --- a/src/operators/kernel/sigmoid_kernel.h +++ b/src/operators/kernel/sigmoid_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 SIGMOID_OP + #pragma once #include "framework/operator.h" @@ -27,3 +29,5 @@ class SigmoidKernel : public OpKernelBase { }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/softmax_kernel.h b/src/operators/kernel/softmax_kernel.h index 5bdae46d288adef3c07c6b2735bdfe5e6ec0c1c3..2b2d753cf666a6eb58f70f2f43afbbefb3953d8b 100644 --- a/src/operators/kernel/softmax_kernel.h +++ b/src/operators/kernel/softmax_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 SOFTMAX_OP + #pragma once #include "framework/operator.h" @@ -30,3 +32,5 @@ class SoftmaxKernel : public OpKernelBase { }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/kernel/transpose_kernel.h b/src/operators/kernel/transpose_kernel.h index aa7d8902097df441eaa28ea8a74b5e9234f7daea..82d73ac82cd28edbd5b6fc349748293fd00fcf45 100644 --- a/src/operators/kernel/transpose_kernel.h +++ b/src/operators/kernel/transpose_kernel.h @@ -12,13 +12,15 @@ 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 TRANSPOSE_OP + +#pragma once + #include #include "framework/operator.h" #include "operators/op_param.h" -#pragma once; - namespace paddle_mobile { namespace operators { @@ -30,3 +32,5 @@ class TransposeKernel }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/lrn_op.cpp b/src/operators/lrn_op.cpp index cc89a034b4c43bcee7778cad0c16c614e74bb5fb..f072b22b063c6eb28cb5c0a183b51e6071c82bd3 100644 --- a/src/operators/lrn_op.cpp +++ b/src/operators/lrn_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 LRN_OP + #include "lrn_op.h" namespace paddle_mobile { @@ -29,3 +31,5 @@ template class LrnOp; namespace ops = paddle_mobile::operators; USE_OP(lrn); REGISTER_OPERATOR(lrn, ops::LrnOp); + +#endif diff --git a/src/operators/lrn_op.h b/src/operators/lrn_op.h index e5d98e1bb103307e1fae9c2460be19fe9d0f01a0..931c6b4ab069abf9eed496e433a114895f0ace54 100644 --- a/src/operators/lrn_op.h +++ b/src/operators/lrn_op.h @@ -11,6 +11,9 @@ 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 LRN_OP + #pragma once #include @@ -45,3 +48,5 @@ class LrnOp : public framework::OperatorWithKernel { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/math/pool3x3.h b/src/operators/math/pool3x3.h index 3852b901871eb4cdcff0497a1ad2854abf93b7b6..164958288de5cf3bb37dcb2d37c7fe08b7bd7a1a 100644 --- a/src/operators/math/pool3x3.h +++ b/src/operators/math/pool3x3.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 POOL_OP + #pragma once #if __ARM_NEON @@ -25,3 +27,5 @@ static void Pool3x3Max() { static void Pool3x3Avg() { // todo impl with neon } + +#endif diff --git a/src/operators/math/pool_2x2.h b/src/operators/math/pool_2x2.h index 0ed7f4e6abd4f7c78a9f14652fcf662a99d1e549..46e9e36470ceeee39563dc410e63a09aaec973bb 100644 --- a/src/operators/math/pool_2x2.h +++ b/src/operators/math/pool_2x2.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 POOL_OP + #pragma once #if __ARM_NEON @@ -25,3 +27,5 @@ static void Pool2x2Max() { static void Pool2x2Avg() { // todo impl with neon } + +#endif diff --git a/src/operators/math/pooling.cpp b/src/operators/math/pooling.cpp index 07afdb7d14a7260e547e072cc67bd1613e812944..0a823f2cc066e487bf1e3131105b28c0a44e44a4 100644 --- a/src/operators/math/pooling.cpp +++ b/src/operators/math/pooling.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 POOL_OP + #include "pooling.h" #include @@ -91,3 +93,5 @@ template class PoolFunctor, float>; } // namespace math } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/math/pooling.h b/src/operators/math/pooling.h index e511fc0518cb755d481b347df449d0e242a58e14..fc6aabb5f13fdedd9dfe9877748aa4d58b3afe36 100644 --- a/src/operators/math/pooling.h +++ b/src/operators/math/pooling.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 POOL_OP + #pragma once #include "common/log.h" @@ -64,3 +66,5 @@ class PoolFunctor { } } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/math/softmax.cpp b/src/operators/math/softmax.cpp index 224382eb2b78b1653da0cbbd9327cabb4fd9b3d1..a1eb4f13d82376d86da258101b15e6ae5e8bdc97 100644 --- a/src/operators/math/softmax.cpp +++ b/src/operators/math/softmax.cpp @@ -11,6 +11,9 @@ 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 SOFTMAX_OP + #include "operators/math/softmax.h" #include "common/types.h" #if __ARM_NEON @@ -153,3 +156,4 @@ template class SoftmaxFuntor; } // namespace math } // namespace operators } // namespace paddle_mobile +#endif diff --git a/src/operators/math/softmax.h b/src/operators/math/softmax.h index 232497da531a44c14772916fa26328c4b3a1f130..e2ca8f30b067e9262a0e87f4ba5807df07949e73 100644 --- a/src/operators/math/softmax.h +++ b/src/operators/math/softmax.h @@ -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 SOFTMAX_OP #pragma once #include "framework/tensor.h" namespace paddle_mobile { @@ -26,3 +27,4 @@ class SoftmaxFuntor { } // namespace math } // namespace operators } // namespace paddle_mobile +#endif diff --git a/src/operators/mul_op.cpp b/src/operators/mul_op.cpp index 80c20122f4b04a3de13a95bc8ed26d48f7464f44..2bd2e0694470518a0220ee020e689e358d70d702 100644 --- a/src/operators/mul_op.cpp +++ b/src/operators/mul_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 MUL_OP + #include "mul_op.h" namespace paddle_mobile { @@ -55,3 +57,5 @@ template class MulOp; namespace ops = paddle_mobile::operators; USE_OP(mul); REGISTER_OPERATOR(mul, ops::MulOp); + +#endif diff --git a/src/operators/mul_op.h b/src/operators/mul_op.h index ded618551fca682daea0bacc3635776eeb81301c..85c6c80b925d0be6507bea9a4262a0e6185324a7 100644 --- a/src/operators/mul_op.h +++ b/src/operators/mul_op.h @@ -11,6 +11,9 @@ 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 MUL_OP + #pragma once #include @@ -45,3 +48,5 @@ class MulOp : public framework::OperatorWithKernel { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/multiclass_nms_op.cpp b/src/operators/multiclass_nms_op.cpp index bc796010b231929b3f0c017b68f33b861a84262d..1e4c3f8c34020eeeec2e59cb499b7e00c95edb38 100644 --- a/src/operators/multiclass_nms_op.cpp +++ b/src/operators/multiclass_nms_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 MULTICLASSNMS_OP + #include "operators/multiclass_nms_op.h" namespace paddle_mobile { namespace operators { @@ -39,3 +41,5 @@ template class MultiClassNMSOp; namespace ops = paddle_mobile::operators; USE_OP(multiclass_nms); REGISTER_OPERATOR(multiclass_nms, ops::MultiClassNMSOp); + +#endif diff --git a/src/operators/multiclass_nms_op.h b/src/operators/multiclass_nms_op.h index c424856b8cdc09b365a7ece28df39a911b6d3af8..78d6ec31204b4a103f59f99cb1aafd5a16ea985a 100644 --- a/src/operators/multiclass_nms_op.h +++ b/src/operators/multiclass_nms_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 MULTICLASSNMS_OP + #pragma once #include @@ -50,3 +52,5 @@ class MultiClassNMSOp : public framework::OperatorWithKernel { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/op_param.cpp b/src/operators/op_param.cpp index ac6ae4cdef77af623097bf6a6d1e73f55339a71a..3045ce4d087bad48927fd3054ef7c2941587b5e2 100644 --- a/src/operators/op_param.cpp +++ b/src/operators/op_param.cpp @@ -13,9 +13,10 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "op_param.h" - namespace paddle_mobile { namespace operators { + +#ifdef CONV_OP Print &operator<<(Print &printer, const ConvParam &conv_param) { printer << "parameter of conv: " << "\n"; @@ -36,5 +37,7 @@ Print &operator<<(Print &printer, const ConvParam &conv_param) { printer << " output dims: " << conv_param.Output()->dims(); return printer; } +#endif + } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/op_param.h b/src/operators/op_param.h index 11f619346eed9f3b4309ec983de6f0b09f1142b7..22890c4453d8a91b21bc7848a87d8159be804d90 100644 --- a/src/operators/op_param.h +++ b/src/operators/op_param.h @@ -191,6 +191,7 @@ class OpParam { } }; +#ifdef CONV_OP class ConvParam : OpParam { public: ConvParam(const VariableNameMap &inputs, const VariableNameMap &outputs, @@ -230,7 +231,9 @@ class ConvParam : OpParam { }; Print &operator<<(Print &printer, const ConvParam &conv_param); +#endif +#ifdef ELEMENTWISEADD_OP class ElementwiseAddParam : OpParam { public: ElementwiseAddParam(const VariableNameMap &inputs, @@ -258,6 +261,9 @@ class ElementwiseAddParam : OpParam { int axis_; }; +#endif + +#ifdef MUL_OP class MulParam : OpParam { public: MulParam(const VariableNameMap &inputs, const VariableNameMap &outputs, @@ -287,7 +293,9 @@ class MulParam : OpParam { int x_num_col_dims_; int y_num_col_dims_; }; +#endif +#ifdef CONCAT_OP class ConcatParam : public OpParam { public: ConcatParam(const VariableNameMap &inputs, const VariableNameMap &outputs, @@ -309,7 +317,9 @@ class ConcatParam : public OpParam { Tensor *out_; int axis_; }; +#endif +#ifdef LRN_OP class LrnParam : public OpParam { public: LrnParam(const VariableNameMap &inputs, const VariableNameMap &outputs, @@ -351,6 +361,9 @@ class LrnParam : public OpParam { float k_; string data_format_; }; +#endif + +#ifdef BATCHNORM_OP class BatchNormParam : OpParam { public: BatchNormParam(const VariableNameMap &inputs, const VariableNameMap &outputs, @@ -399,6 +412,9 @@ class BatchNormParam : OpParam { bool is_test_; string data_format_; }; +#endif + +#ifdef POOL_OP class PoolParam : public OpParam { public: PoolParam(const VariableNameMap &inputs, const VariableNameMap &outputs, @@ -442,6 +458,9 @@ class PoolParam : public OpParam { bool gloabal_pooling_ = false; }; +#endif + +#ifdef PRIORBOX_OP class PriorBoxParam : public OpParam { public: PriorBoxParam(const VariableNameMap &inputs, const VariableNameMap &outputs, @@ -503,7 +522,9 @@ class PriorBoxParam : public OpParam { float step_h_; float offset_; }; +#endif +#ifdef BOXCODER_OP class BoxCoderParam : public OpParam { public: BoxCoderParam(const VariableNameMap &inputs, const VariableNameMap &outputs, @@ -533,7 +554,9 @@ class BoxCoderParam : public OpParam { Tensor *output_box_; std::string code_type_; }; +#endif +#ifdef SOFTMAX_OP class SoftmaxParam : public OpParam { public: SoftmaxParam(const VariableNameMap &inputs, const VariableNameMap &outputs, @@ -549,7 +572,9 @@ class SoftmaxParam : public OpParam { Tensor *input_x_; Tensor *out_; }; +#endif +#ifdef SIGMOID_OP class SigmoidParam : public OpParam { public: SigmoidParam(const VariableNameMap &inputs, const VariableNameMap &outputs, @@ -565,6 +590,9 @@ class SigmoidParam : public OpParam { Tensor *input_x_; Tensor *out_; }; +#endif + +#ifdef MULTICLASSNMS_OP class MultiClassNMSParam : public OpParam { public: MultiClassNMSParam(const VariableNameMap &inputs, @@ -610,6 +638,7 @@ class MultiClassNMSParam : public OpParam { float nms_eta_; float score_threshold_; }; +#endif class FeedParam : public OpParam { public: @@ -646,6 +675,7 @@ class FetchParam : public OpParam { Tensor *out_; }; +#ifdef TRANSPOSE_OP class TransposeParam : public OpParam { public: TransposeParam(const VariableNameMap &inputs, const VariableNameMap &outputs, @@ -666,7 +696,9 @@ class TransposeParam : public OpParam { Tensor *out_; vector axis_; }; +#endif +#ifdef RESHAPE_OP class ReshapeParam : public OpParam { public: ReshapeParam(const VariableNameMap &inputs, const VariableNameMap &outputs, @@ -695,7 +727,9 @@ class ReshapeParam : public OpParam { vector shape_; bool inplace_; }; +#endif +#ifdef RELU_OP /* * @b op 层实例化好这个 param 传递给 kernel 层使用 * */ @@ -715,7 +749,9 @@ class ReluParam : public OpParam { Tensor *input_x_; Tensor *out_; }; +#endif +#ifdef FUSION_FC_OP class FushionFcParam : public OpParam { public: FushionFcParam(const VariableNameMap &inputs, const VariableNameMap &outputs, @@ -751,6 +787,7 @@ class FushionFcParam : public OpParam { int y_num_col_dims_; int axis_; }; +#endif } // namespace operators } // namespace paddle_mobile diff --git a/src/operators/pool_op.cpp b/src/operators/pool_op.cpp index 3096199dc3e3157f9fa0048ad35f796e24113f28..e1c5b5ada3478fe35eb989a262815917205b5063 100644 --- a/src/operators/pool_op.cpp +++ b/src/operators/pool_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 POOL_OP + #include "pool_op.h" namespace paddle_mobile { @@ -57,3 +59,5 @@ template class PoolOp; namespace ops = paddle_mobile::operators; USE_OP(pool2d); REGISTER_OPERATOR(pool2d, ops::PoolOp); + +#endif diff --git a/src/operators/pool_op.h b/src/operators/pool_op.h index ff44771c56151acf699b017ddf834a2d32e07761..9ad0bd3e3b95503c53bbeed6a8bca7fdb48ac23e 100644 --- a/src/operators/pool_op.h +++ b/src/operators/pool_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 POOL_OP + #pragma once #include @@ -47,3 +49,5 @@ class PoolOp : public OperatorWithKernel { }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/prior_box_op.cpp b/src/operators/prior_box_op.cpp index 3928c3db53414dbb3ef9a6ae4ebe5527dc5eeeca..22f9326b00f41a96de2f6ce3d79f8cbee98fd9f4 100644 --- a/src/operators/prior_box_op.cpp +++ b/src/operators/prior_box_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 PRIORBOX_OP + #include "operators/prior_box_op.h" #include namespace paddle_mobile { @@ -49,3 +51,5 @@ template class PriorBoxOp; namespace ops = paddle_mobile::operators; USE_OP(prior_box); REGISTER_OPERATOR(prior_box, ops::PriorBoxOp); + +#endif diff --git a/src/operators/prior_box_op.h b/src/operators/prior_box_op.h index 84481e602a6cb4143a50760e66b0d430b8a1c719..55080f3c5a77683acc5ee76fc6ab91545004d010 100644 --- a/src/operators/prior_box_op.h +++ b/src/operators/prior_box_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 PRIORBOX_OP + #pragma once #include @@ -50,3 +52,5 @@ class PriorBoxOp : public framework::OperatorWithKernel { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/relu_op.cpp b/src/operators/relu_op.cpp index 21bcc605282ffc590025e87b609cccc855a631d1..3beac260935ce2daf8a5b9f1e6b9be178034ac8d 100644 --- a/src/operators/relu_op.cpp +++ b/src/operators/relu_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 RELU_OP + #include "operators/relu_op.h" namespace paddle_mobile { namespace operators { @@ -33,3 +35,5 @@ template class ReluOp; namespace ops = paddle_mobile::operators; USE_OP(relu); REGISTER_OPERATOR(relu, ops::ReluOp); + +#endif diff --git a/src/operators/relu_op.h b/src/operators/relu_op.h index 7be8cd249cb22255dff237da6c8653e6237bbc3f..e52ef5edd2013e30c5004b629c06aa1affe1d20e 100644 --- a/src/operators/relu_op.h +++ b/src/operators/relu_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 RELU_OP + #pragma once #include @@ -59,3 +61,5 @@ class ReluOp : public framework::OperatorWithKernel { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/reshape_op.cpp b/src/operators/reshape_op.cpp index 6562b7a5eb491a7e69e9bd9481251b8aaf9f3f4b..44d3de2203cc01f6a6acd6810f4e676f6efb6bbd 100644 --- a/src/operators/reshape_op.cpp +++ b/src/operators/reshape_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 RESHAPE_OP + #include "operators/reshape_op.h" #include namespace paddle_mobile { @@ -32,3 +34,5 @@ template class ReshapeOp; namespace ops = paddle_mobile::operators; USE_OP(reshape); REGISTER_OPERATOR(reshape, ops::ReshapeOp); + +#endif diff --git a/src/operators/reshape_op.h b/src/operators/reshape_op.h index b244e62a930a0e6a98d56fe06a4e4a7e37f7d5e1..ce106125cb6a5b48c3bc9c03e20c7dbec90c90c0 100644 --- a/src/operators/reshape_op.h +++ b/src/operators/reshape_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 RESHAPE_OP + #pragma once #include @@ -49,3 +51,5 @@ class ReshapeOp : public framework::OperatorWithKernel { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/sigmoid_op.cpp b/src/operators/sigmoid_op.cpp index 6bff80a35aa019a7b05f6e9b58c49e13fb8f1bc8..8be9309d1047a1d892c0c0151375a8baa01cbca3 100644 --- a/src/operators/sigmoid_op.cpp +++ b/src/operators/sigmoid_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 SIGMOID_OP + #include "operators/sigmoid_op.h" namespace paddle_mobile { @@ -27,3 +29,5 @@ template class SigmoidOp; namespace ops = paddle_mobile::operators; USE_OP(sigmoid); REGISTER_OPERATOR(sigmoid, ops::SigmoidOp); + +#endif diff --git a/src/operators/sigmoid_op.h b/src/operators/sigmoid_op.h index f631ba51759ea31f91ddcdf7c90a0dc874e86b20..3757e2de168e75764b9d8d1d249fe3d8c87d817a 100644 --- a/src/operators/sigmoid_op.h +++ b/src/operators/sigmoid_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 SIGMOID_OP + #pragma once #include @@ -47,3 +49,5 @@ class SigmoidOp : public framework::OperatorWithKernel { }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/softmax_op.cpp b/src/operators/softmax_op.cpp index c353d0b882cb8f0682f9e4710ff05c32ca68e685..5973647bfd1624fc4bb71b8112c5d7f8bf9665cd 100644 --- a/src/operators/softmax_op.cpp +++ b/src/operators/softmax_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 SOFTMAX_OP + #include "operators/softmax_op.h" namespace paddle_mobile { @@ -27,3 +29,5 @@ template class SoftmaxOp; namespace ops = paddle_mobile::operators; USE_OP(softmax); REGISTER_OPERATOR(softmax, ops::SoftmaxOp); + +#endif diff --git a/src/operators/softmax_op.h b/src/operators/softmax_op.h index 07fd9b945cb29cecd6f4d629b6be58035f971ce4..1c764248cb72f84adb7665ced0a4375a3cd79624 100644 --- a/src/operators/softmax_op.h +++ b/src/operators/softmax_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 SOFTMAX_OP + #pragma once #include @@ -47,3 +49,5 @@ class SoftmaxOp : public framework::OperatorWithKernel { }; } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/operators/transpose_op.cpp b/src/operators/transpose_op.cpp index e21338bf1b59981e914ca4a8e1781e02254bc00c..c8e16f9e4b42037eee84dbe5cd023b67e781f2a5 100644 --- a/src/operators/transpose_op.cpp +++ b/src/operators/transpose_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 TRANSPOSE_OP + #include "operators/transpose_op.h" #include #include @@ -51,3 +53,5 @@ template class TransposeOp; namespace ops = paddle_mobile::operators; USE_OP(transpose); REGISTER_OPERATOR(transpose, ops::TransposeOp); + +#endif diff --git a/src/operators/transpose_op.h b/src/operators/transpose_op.h index 0f67339533261f98374c6257494278306f3a7208..728c6991c014fcf37b9c0b4f467ccc1c4999883b 100644 --- a/src/operators/transpose_op.h +++ b/src/operators/transpose_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 TRANSPOSE_OP + #pragma once #include @@ -50,3 +52,5 @@ class TransposeOp : public framework::OperatorWithKernel { } // namespace operators } // namespace paddle_mobile + +#endif diff --git a/src/platform/data_type.h b/src/platform/data_type.h deleted file mode 100644 index 44e0158a7cd7f912689f8514c9c8cfddae5654a1..0000000000000000000000000000000000000000 --- a/src/platform/data_type.h +++ /dev/null @@ -1,125 +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. */ - -#pragma once - -#include -#include - -#include "framework/program/tensor_desc.h" - -namespace paddle_mobile { -namespace framework { - -inline VarType_Type ToDataType(std::type_index type) { - /*if (typeid(platform::float16).hash_code() == type.hash_code()) { - return proto::VarType::FP16; - } else */ - if (typeid(const float).hash_code() == type.hash_code()) { - // CPPLint complains Using C-style cast. Use - // static_cast() instead - // One fix to this is to replace float with const float because - // typeid(T) == typeid(const T) - // http://en.cppreference.com/w/cpp/language/typeid - return VARTYPE_TYPE_FP32; - } else if (typeid(const double).hash_code() == type.hash_code()) { - return VARTYPE_TYPE_FP64; - } else if (typeid(const int).hash_code() == type.hash_code()) { - return VARTYPE_TYPE_INT32; - } else if (typeid(const int64_t).hash_code() == type.hash_code()) { - return VARTYPE_TYPE_INT64; - } else if (typeid(const bool).hash_code() == type.hash_code()) { - return VARTYPE_TYPE_BOOL; - } else { - // PADDLE_THROW("Not supported"); - // std::cout << "Not supported"; - } -} - -inline std::type_index ToTypeIndex(VarType_Type type) { - switch (type) { - // case proto::VarType::FP16: - // return typeid(platform::float16); - case VARTYPE_TYPE_FP32: - return typeid(float); - case VARTYPE_TYPE_FP64: - return typeid(double); - case VARTYPE_TYPE_INT32: - return typeid(int); - case VARTYPE_TYPE_INT64: - return typeid(int64_t); - case VARTYPE_TYPE_BOOL: - return typeid(bool); - default: - // PADDLE_THROW("Not support type %d", type); - printf("Not support type %d", type); - } -} - -template -inline void VisitDataType(VarType_Type type, Visitor visitor) { - switch (type) { - // case proto::VarType::FP16: - // visitor.template operator()(); - // break; - case VARTYPE_TYPE_FP32: - visitor.template operator()(); - break; - case VARTYPE_TYPE_FP64: - visitor.template operator()(); - break; - case VARTYPE_TYPE_INT32: - visitor.template operator()(); - break; - case VARTYPE_TYPE_INT64: - visitor.template operator()(); - break; - case VARTYPE_TYPE_BOOL: - visitor.template operator()(); - break; - default: - // PADDLE_THROW("Not supported"); - printf("Not supported"); - } -} - -inline std::string DataTypeToString(const VarType_Type type) { - switch (type) { - case VARTYPE_TYPE_FP16: - return "float16"; - case VARTYPE_TYPE_FP32: - return "float32"; - case VARTYPE_TYPE_FP64: - return "float64"; - case VARTYPE_TYPE_INT16: - return "int16"; - case VARTYPE_TYPE_INT32: - return "int32"; - case VARTYPE_TYPE_INT64: - return "int64"; - case VARTYPE_TYPE_BOOL: - return "bool"; - default: - // PADDLE_THROW("Not support type %d", type); - printf("Not support type %d", type); - } -} - -inline std::ostream &operator<<(std::ostream &out, const VarType_Type &type) { - out << DataTypeToString(type); - return out; -} - -} // namespace framework -} // namespace paddle_mobile diff --git a/src/platform/hostdevice.h b/src/platform/hostdevice.h deleted file mode 100644 index 6139fb94b998b2a9b261064d1b0428e0c65cf69e..0000000000000000000000000000000000000000 --- a/src/platform/hostdevice.h +++ /dev/null @@ -1,25 +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. */ - -#pragma once - -#ifdef __CUDACC__ -#define HOSTDEVICE __host__ __device__ -#define DEVICE __device__ -#define HOST __host__ -#else -#define HOSTDEVICE -#define DEVICE -#define HOST -#endif diff --git a/test/framework/test_load.cpp b/test/framework/test_load.cpp index 45d7324bf5a694a7f08d803b32aeec9f0b2ca30f..a1f092c4d81ee09d3327a0e2d5425e20dad1ae89 100644 --- a/test/framework/test_load.cpp +++ b/test/framework/test_load.cpp @@ -19,7 +19,7 @@ int main() { paddle_mobile::Loader loader; // ../../../test/models/googlenet // ../../../test/models/mobilenet - auto program = loader.Load(g_mobilenet_ssd, true); + auto program = loader.Load(g_resnet, true); program.originProgram->Description("program desc: "); return 0; } diff --git a/tools/build.sh b/tools/build.sh index ba01ea75bc5fb279552939bb191239db16c49a3d..b13f077ad3521bc0c5cddbe5a28027e8684c5bf4 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -55,10 +55,25 @@ build_for_android() { exit -1 fi + MODE="Release" ANDROID_PLATFORM_VERSION="android-15" TOOLCHAIN_FILE="./tools/android-cmake/android.toolchain.cmake" ANDROID_ARM_MODE="arm" + if [ $# -eq 1 ]; then + NET=$1 + cmake . \ + -B"build/release/${PLATFORM}" \ + -DANDROID_ABI="${ABI}" \ + -DCMAKE_BUILD_TYPE="${MODE}" \ + -DCMAKE_TOOLCHAIN_FILE="${TOOLCHAIN_FILE}" \ + -DANDROID_PLATFORM="${ANDROID_PLATFORM_VERSION}" \ + -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" \ + -DANDROID_STL=c++_static \ + -DANDROID=true \ + -D"${NET}=true" \ + -D"${ARM_PLATFORM}"=true + else cmake .. \ -B"../build/release/${PLATFORM}" \ @@ -70,9 +85,10 @@ build_for_android() { -DANDROID_STL=c++_static \ -DANDROID=true \ -D"${ARM_PLATFORM}"=true - - cd "../build/release/${PLATFORM}" + fi + cd "./build/release/${PLATFORM}" make -j 8 + } build_for_ios() { @@ -106,15 +122,44 @@ if [ $# -lt 1 ]; then echo "available targets: mac|linux|ios|android" echo "sample usage: ./build.sh mac" else - if [ $1 = "mac" ]; then - build_for_mac - elif [ $1 = "linux" ]; then - build_for_linux - elif [ $1 = "android" ]; then - build_for_android - elif [ $1 = "ios" ]; then - build_for_ios - else - build_error + if [ $# -eq 2 ]; then + + if [[$2 != "googlenet"]] -a [[$2 != "mobilenet"]] -a [[$2 != "yolo"]] -a [[$2 != "squeezenet"]] -a [[$2 != "resnet"]]; then + if [ $1 = "mac" ]; then + build_for_mac + elif [ $1 = "linux" ]; then + build_for_linux + elif [ $1 = "android" ]; then + build_for_android + elif [ $1 = "ios" ]; then + build_for_ios + else + build_error + fi + else + if [ $1 = "mac" ]; then + build_for_mac $2 + elif [ $1 = "linux" ]; then + build_for_linux $2 + elif [ $1 = "android" ]; then + build_for_android $2 + elif [ $1 = "ios" ]; then + build_for_ios $2 + else + build_error + fi + fi + else + if [ $1 = "mac" ]; then + build_for_mac + elif [ $1 = "linux" ]; then + build_for_linux + elif [ $1 = "android" ]; then + build_for_android + elif [ $1 = "ios" ]; then + build_for_ios + else + build_error + fi fi fi