Remove eigen compliation option (#161)

Remove eigen option
This commit is contained in:
Jack Zhou
2022-08-26 11:20:52 +08:00
committed by GitHub
parent e345ef6fd9
commit 391d66381f
10 changed files with 10 additions and 35 deletions

View File

@@ -49,8 +49,6 @@ option(ENABLE_VISION "Whether to enable vision models usage." OFF)
option(ENABLE_VISION_VISUALIZE "Whether to enable visualize vision model result toolbox." ON) option(ENABLE_VISION_VISUALIZE "Whether to enable visualize vision model result toolbox." ON)
option(ENABLE_TEXT "Whether to enable text models usage." OFF) option(ENABLE_TEXT "Whether to enable text models usage." OFF)
option(WITH_TESTING "Whether to compile with unittest." OFF) option(WITH_TESTING "Whether to compile with unittest." OFF)
# TODO(zhoushunjie): Will remove it later.
option(ENABLE_FDTENSOR_FUNC "Whether to compile with function of FDTensor." OFF)
# Please don't open this flag now, some bugs exists. # Please don't open this flag now, some bugs exists.
option(ENABLE_OPENCV_CUDA "Whether to enable opencv with cuda, this will allow process image with GPU." OFF) option(ENABLE_OPENCV_CUDA "Whether to enable opencv with cuda, this will allow process image with GPU." OFF)
@@ -122,7 +120,7 @@ file(GLOB_RECURSE DEPLOY_OPENVINO_SRCS ${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/f
file(GLOB_RECURSE DEPLOY_VISION_SRCS ${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/vision/*.cc) file(GLOB_RECURSE DEPLOY_VISION_SRCS ${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/vision/*.cc)
file(GLOB_RECURSE DEPLOY_TEXT_SRCS ${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/text/*.cc) file(GLOB_RECURSE DEPLOY_TEXT_SRCS ${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/text/*.cc)
file(GLOB_RECURSE DEPLOY_PYBIND_SRCS ${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/pybind/*.cc ${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/*_pybind.cc) file(GLOB_RECURSE DEPLOY_PYBIND_SRCS ${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/pybind/*.cc ${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/*_pybind.cc)
list(REMOVE_ITEM ALL_DEPLOY_SRCS ${DEPLOY_ORT_SRCS} ${DEPLOY_PADDLE_SRCS} ${DEPLOY_TRT_SRCS} ${DEPLOY_OPENVINO_SRCS} ${DEPLOY_VISION_SRCS} ${DEPLOY_TEXT_SRCS} ${FDTENSOR_FUNC_SRCS}) list(REMOVE_ITEM ALL_DEPLOY_SRCS ${DEPLOY_ORT_SRCS} ${DEPLOY_PADDLE_SRCS} ${DEPLOY_TRT_SRCS} ${DEPLOY_OPENVINO_SRCS} ${DEPLOY_VISION_SRCS} ${DEPLOY_TEXT_SRCS})
set(DEPEND_LIBS "") set(DEPEND_LIBS "")
@@ -130,9 +128,9 @@ file(READ "${PROJECT_SOURCE_DIR}/VERSION_NUMBER" FASTDEPLOY_VERSION)
string(STRIP "${FASTDEPLOY_VERSION}" FASTDEPLOY_VERSION) string(STRIP "${FASTDEPLOY_VERSION}" FASTDEPLOY_VERSION)
set(THIRD_PARTY_PATH ${CMAKE_CURRENT_BINARY_DIR}/third_libs) set(THIRD_PARTY_PATH ${CMAKE_CURRENT_BINARY_DIR}/third_libs)
if(ENABLE_FDTENSOR_FUNC OR ENABLE_TEXT)
include(external/eigen.cmake) include(external/eigen.cmake)
endif()
if(ENABLE_PADDLE_FRONTEND) if(ENABLE_PADDLE_FRONTEND)
add_definitions(-DENABLE_PADDLE_FRONTEND) add_definitions(-DENABLE_PADDLE_FRONTEND)
include(${PROJECT_SOURCE_DIR}/external/paddle2onnx.cmake) include(${PROJECT_SOURCE_DIR}/external/paddle2onnx.cmake)
@@ -257,11 +255,6 @@ if(ENABLE_TEXT)
include(external/faster_tokenizer.cmake) include(external/faster_tokenizer.cmake)
endif() endif()
if (ENABLE_FDTENSOR_FUNC)
add_definitions(-DENABLE_FDTENSOR_FUNC)
list(APPEND ALL_DEPLOY_SRCS ${FDTENSOR_FUNC_SRCS})
endif()
configure_file(${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/core/config.h.in ${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/core/config.h) configure_file(${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/core/config.h.in ${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/core/config.h)
configure_file(${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/pybind/main.cc.in ${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/pybind/main.cc) configure_file(${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/pybind/main.cc.in ${PROJECT_SOURCE_DIR}/${CSRCS_DIR_NAME}/fastdeploy/pybind/main.cc)
configure_file(${PROJECT_SOURCE_DIR}/FastDeploy.cmake.in ${PROJECT_SOURCE_DIR}/FastDeploy.cmake @ONLY) configure_file(${PROJECT_SOURCE_DIR}/FastDeploy.cmake.in ${PROJECT_SOURCE_DIR}/FastDeploy.cmake @ONLY)
@@ -270,9 +263,7 @@ configure_file(${PROJECT_SOURCE_DIR}/fastdeploy/c_lib_wrap.py.in ${PROJECT_SOURC
list(REMOVE_ITEM ALL_DEPLOY_SRCS ${DEPLOY_PYBIND_SRCS}) list(REMOVE_ITEM ALL_DEPLOY_SRCS ${DEPLOY_PYBIND_SRCS})
add_library(${LIBRARY_NAME} SHARED ${ALL_DEPLOY_SRCS}) add_library(${LIBRARY_NAME} SHARED ${ALL_DEPLOY_SRCS})
if(ENABLE_FDTENSOR_FUNC OR ENABLE_TEXT) add_dependencies(${LIBRARY_NAME} extern_eigen3)
add_dependencies(${LIBRARY_NAME} extern_eigen3)
endif()
redefine_file_macro(${LIBRARY_NAME}) redefine_file_macro(${LIBRARY_NAME})
set_target_properties(${LIBRARY_NAME} PROPERTIES COMPILE_FLAGS "-fvisibility=hidden") set_target_properties(${LIBRARY_NAME} PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")

View File

@@ -24,8 +24,6 @@
namespace fastdeploy { namespace fastdeploy {
#ifdef ENABLE_FDTENSOR_FUNC
template <typename T, size_t D, size_t R_D, typename Functor> template <typename T, size_t D, size_t R_D, typename Functor>
void ReduceFunctor(const FDTensor& input, FDTensor* output, void ReduceFunctor(const FDTensor& input, FDTensor* output,
const std::vector<int64_t>& dims, bool keep_dim) { const std::vector<int64_t>& dims, bool keep_dim) {
@@ -404,6 +402,4 @@ void ArgMin(const FDTensor& x, FDTensor* out, int64_t axis,
})); }));
} }
#endif
} // namespace fastdeploy } // namespace fastdeploy

View File

@@ -18,7 +18,6 @@
namespace fastdeploy { namespace fastdeploy {
#ifdef ENABLE_FDTENSOR_FUNC
/** Excute the maximum operation for input FDTensor along given dims. /** Excute the maximum operation for input FDTensor along given dims.
@param x The input tensor. @param x The input tensor.
@param out The output tensor which stores the result. @param out The output tensor which stores the result.
@@ -124,5 +123,4 @@ FASTDEPLOY_DECL void ArgMin(const FDTensor& x, FDTensor* out, int64_t axis,
FDDataType output_dtype = FDDataType::INT64, FDDataType output_dtype = FDDataType::INT64,
bool keep_dim = false, bool flatten = false); bool keep_dim = false, bool flatten = false);
#endif
} // namespace fastdeploy } // namespace fastdeploy

View File

@@ -21,8 +21,6 @@
#include "fastdeploy/utils/utils.h" #include "fastdeploy/utils/utils.h"
namespace fastdeploy { namespace fastdeploy {
#ifdef ENABLE_FDTENSOR_FUNC
template <typename T> template <typename T>
struct ValueClip { struct ValueClip {
T operator()(const T& x) const { T operator()(const T& x) const {
@@ -122,5 +120,4 @@ void Softmax(const FDTensor& x, FDTensor* out, int axis) {
FD_VISIT_FLOAT_TYPES(x.dtype, "SoftmaxKernel", FD_VISIT_FLOAT_TYPES(x.dtype, "SoftmaxKernel",
([&] { SoftmaxKernel<data_t>(x, out, axis); })); ([&] { SoftmaxKernel<data_t>(x, out, axis); }));
} }
#endif
} // namespace fastdeploy } // namespace fastdeploy

View File

@@ -18,7 +18,6 @@
namespace fastdeploy { namespace fastdeploy {
#ifdef ENABLE_FDTENSOR_FUNC
/** Excute the softmax operation for input FDTensor along given dims. /** Excute the softmax operation for input FDTensor along given dims.
@param x The input tensor. @param x The input tensor.
@param out The output tensor which stores the result. @param out The output tensor which stores the result.
@@ -26,5 +25,4 @@ namespace fastdeploy {
*/ */
FASTDEPLOY_DECL void Softmax(const FDTensor& x, FDTensor* out, int axis = -1); FASTDEPLOY_DECL void Softmax(const FDTensor& x, FDTensor* out, int axis = -1);
#endif
} // namespace fastdeploy } // namespace fastdeploy

View File

@@ -17,7 +17,6 @@
#include "fastdeploy/utils/utils.h" #include "fastdeploy/utils/utils.h"
namespace fastdeploy { namespace fastdeploy {
#ifdef ENABLE_FDTENSOR_FUNC
template <typename T> template <typename T>
struct TransposeNormalKernel { struct TransposeNormalKernel {
@@ -115,5 +114,5 @@ void Transpose(const FDTensor& x, FDTensor* out,
FD_VISIT_ALL_TYPES(x.dtype, "TransposeKernel", FD_VISIT_ALL_TYPES(x.dtype, "TransposeKernel",
([&] { TransposeKernel<data_t>(x, out, dims); })); ([&] { TransposeKernel<data_t>(x, out, dims); }));
} }
#endif
} // namespace fastdeploy } // namespace fastdeploy

View File

@@ -17,7 +17,7 @@
#include "fastdeploy/core/fd_tensor.h" #include "fastdeploy/core/fd_tensor.h"
namespace fastdeploy { namespace fastdeploy {
#ifdef ENABLE_FDTENSOR_FUNC
/** Excute the transpose operation for input FDTensor along given dims. /** Excute the transpose operation for input FDTensor along given dims.
@param x The input tensor. @param x The input tensor.
@param out The output tensor which stores the result. @param out The output tensor which stores the result.
@@ -25,5 +25,4 @@ namespace fastdeploy {
*/ */
FASTDEPLOY_DECL void Transpose(const FDTensor& x, FDTensor* out, FASTDEPLOY_DECL void Transpose(const FDTensor& x, FDTensor* out,
const std::vector<int64_t>& dims); const std::vector<int64_t>& dims);
#endif
} // namespace fastdeploy } // namespace fastdeploy

View File

@@ -22,7 +22,6 @@
namespace fastdeploy { namespace fastdeploy {
#ifdef ENABLE_FDTENSOR_FUNC
TEST(fastdeploy, reduce_max) { TEST(fastdeploy, reduce_max) {
FDTensor input, output; FDTensor input, output;
CheckShape check_shape; CheckShape check_shape;
@@ -372,5 +371,4 @@ TEST(fastdeploy, reduce_argmin) {
expected_result_noaxis.data(), expected_result_noaxis.size()); expected_result_noaxis.data(), expected_result_noaxis.size());
} }
#endif
} // namespace fastdeploy } // namespace fastdeploy

View File

@@ -20,7 +20,7 @@
#include "gtest_utils.h" #include "gtest_utils.h"
namespace fastdeploy { namespace fastdeploy {
#ifdef ENABLE_FDTENSOR_FUNC
TEST(fastdeploy, softmax) { TEST(fastdeploy, softmax) {
FDTensor input, output; FDTensor input, output;
CheckShape check_shape; CheckShape check_shape;
@@ -44,5 +44,5 @@ TEST(fastdeploy, softmax) {
check_data(reinterpret_cast<const float*>(output.Data()), check_data(reinterpret_cast<const float*>(output.Data()),
expected_result_axis1.data(), expected_result_axis1.size()); expected_result_axis1.data(), expected_result_axis1.size());
} }
#endif
} // namespace fastdeploy } // namespace fastdeploy

View File

@@ -22,7 +22,7 @@
#include "gtest_utils.h" #include "gtest_utils.h"
namespace fastdeploy { namespace fastdeploy {
#ifdef ENABLE_FDTENSOR_FUNC
TEST(fastdeploy, transpose_2d) { TEST(fastdeploy, transpose_2d) {
FDTensor input, output; FDTensor input, output;
CheckShape check_shape; CheckShape check_shape;
@@ -57,5 +57,4 @@ TEST(fastdeploy, transpose_5d) {
expected_result.data(), expected_result.size()); expected_result.data(), expected_result.size());
} }
#endif
} // namespace fastdeploy } // namespace fastdeploy