mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 17:17:14 +08:00
@@ -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_TEXT "Whether to enable text models usage." 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.
|
||||
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_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)
|
||||
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 "")
|
||||
|
||||
@@ -130,9 +128,9 @@ file(READ "${PROJECT_SOURCE_DIR}/VERSION_NUMBER" FASTDEPLOY_VERSION)
|
||||
string(STRIP "${FASTDEPLOY_VERSION}" FASTDEPLOY_VERSION)
|
||||
|
||||
set(THIRD_PARTY_PATH ${CMAKE_CURRENT_BINARY_DIR}/third_libs)
|
||||
if(ENABLE_FDTENSOR_FUNC OR ENABLE_TEXT)
|
||||
include(external/eigen.cmake)
|
||||
endif()
|
||||
|
||||
include(external/eigen.cmake)
|
||||
|
||||
if(ENABLE_PADDLE_FRONTEND)
|
||||
add_definitions(-DENABLE_PADDLE_FRONTEND)
|
||||
include(${PROJECT_SOURCE_DIR}/external/paddle2onnx.cmake)
|
||||
@@ -257,11 +255,6 @@ if(ENABLE_TEXT)
|
||||
include(external/faster_tokenizer.cmake)
|
||||
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/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)
|
||||
@@ -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})
|
||||
|
||||
add_library(${LIBRARY_NAME} SHARED ${ALL_DEPLOY_SRCS})
|
||||
if(ENABLE_FDTENSOR_FUNC OR ENABLE_TEXT)
|
||||
add_dependencies(${LIBRARY_NAME} extern_eigen3)
|
||||
endif()
|
||||
add_dependencies(${LIBRARY_NAME} extern_eigen3)
|
||||
|
||||
redefine_file_macro(${LIBRARY_NAME})
|
||||
set_target_properties(${LIBRARY_NAME} PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
|
||||
|
@@ -24,8 +24,6 @@
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
#ifdef ENABLE_FDTENSOR_FUNC
|
||||
|
||||
template <typename T, size_t D, size_t R_D, typename Functor>
|
||||
void ReduceFunctor(const FDTensor& input, FDTensor* output,
|
||||
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
|
@@ -18,7 +18,6 @@
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
#ifdef ENABLE_FDTENSOR_FUNC
|
||||
/** Excute the maximum operation for input FDTensor along given dims.
|
||||
@param x The input tensor.
|
||||
@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,
|
||||
bool keep_dim = false, bool flatten = false);
|
||||
|
||||
#endif
|
||||
} // namespace fastdeploy
|
||||
|
@@ -21,8 +21,6 @@
|
||||
#include "fastdeploy/utils/utils.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
#ifdef ENABLE_FDTENSOR_FUNC
|
||||
|
||||
template <typename T>
|
||||
struct ValueClip {
|
||||
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",
|
||||
([&] { SoftmaxKernel<data_t>(x, out, axis); }));
|
||||
}
|
||||
#endif
|
||||
} // namespace fastdeploy
|
||||
|
@@ -18,7 +18,6 @@
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
#ifdef ENABLE_FDTENSOR_FUNC
|
||||
/** Excute the softmax operation for input FDTensor along given dims.
|
||||
@param x The input tensor.
|
||||
@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);
|
||||
|
||||
#endif
|
||||
} // namespace fastdeploy
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#include "fastdeploy/utils/utils.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
#ifdef ENABLE_FDTENSOR_FUNC
|
||||
|
||||
template <typename T>
|
||||
struct TransposeNormalKernel {
|
||||
@@ -115,5 +114,5 @@ void Transpose(const FDTensor& x, FDTensor* out,
|
||||
FD_VISIT_ALL_TYPES(x.dtype, "TransposeKernel",
|
||||
([&] { TransposeKernel<data_t>(x, out, dims); }));
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace fastdeploy
|
@@ -17,7 +17,7 @@
|
||||
#include "fastdeploy/core/fd_tensor.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
#ifdef ENABLE_FDTENSOR_FUNC
|
||||
|
||||
/** Excute the transpose operation for input FDTensor along given dims.
|
||||
@param x The input tensor.
|
||||
@param out The output tensor which stores the result.
|
||||
@@ -25,5 +25,4 @@ namespace fastdeploy {
|
||||
*/
|
||||
FASTDEPLOY_DECL void Transpose(const FDTensor& x, FDTensor* out,
|
||||
const std::vector<int64_t>& dims);
|
||||
#endif
|
||||
} // namespace fastdeploy
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
#ifdef ENABLE_FDTENSOR_FUNC
|
||||
TEST(fastdeploy, reduce_max) {
|
||||
FDTensor input, output;
|
||||
CheckShape check_shape;
|
||||
@@ -372,5 +371,4 @@ TEST(fastdeploy, reduce_argmin) {
|
||||
expected_result_noaxis.data(), expected_result_noaxis.size());
|
||||
}
|
||||
|
||||
#endif
|
||||
} // namespace fastdeploy
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include "gtest_utils.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
#ifdef ENABLE_FDTENSOR_FUNC
|
||||
|
||||
TEST(fastdeploy, softmax) {
|
||||
FDTensor input, output;
|
||||
CheckShape check_shape;
|
||||
@@ -44,5 +44,5 @@ TEST(fastdeploy, softmax) {
|
||||
check_data(reinterpret_cast<const float*>(output.Data()),
|
||||
expected_result_axis1.data(), expected_result_axis1.size());
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace fastdeploy
|
@@ -22,7 +22,7 @@
|
||||
#include "gtest_utils.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
#ifdef ENABLE_FDTENSOR_FUNC
|
||||
|
||||
TEST(fastdeploy, transpose_2d) {
|
||||
FDTensor input, output;
|
||||
CheckShape check_shape;
|
||||
@@ -57,5 +57,4 @@ TEST(fastdeploy, transpose_5d) {
|
||||
expected_result.data(), expected_result.size());
|
||||
}
|
||||
|
||||
#endif
|
||||
} // namespace fastdeploy
|
||||
|
Reference in New Issue
Block a user