From 84e98cdaaffa10a75e4d43e979af5c59527493f3 Mon Sep 17 00:00:00 2001 From: zhengyuanhua Date: Mon, 14 Mar 2022 19:40:21 +0800 Subject: [PATCH] online compile --- CMakeLists.txt | 8 ++++ cmake/external_libs/protobuf.cmake | 6 ++- cmake/package.cmake | 8 ++++ .../cxx_api/model/acl/acl_model_options.h | 2 +- .../ccsrc/cxx_api/model/acl/model_converter.h | 2 +- .../core/mindrt/src/thread/threadpool.cc | 4 ++ mindspore/core/mindrt/src/thread/threadpool.h | 7 ++-- mindspore/core/utils/log_adapter.cc | 2 +- mindspore/lite/CMakeLists.txt | 39 +++++++++++++------ mindspore/lite/cmake/secure_option.cmake | 2 +- mindspore/lite/src/CMakeLists.txt | 8 +++- mindspore/lite/src/inner_context.cc | 2 +- mindspore/lite/src/inner_context.h | 2 +- mindspore/lite/tools/common/protobuf_utils.h | 4 ++ mindspore/lite/tools/converter/CMakeLists.txt | 11 +++++- .../converter/adapter/acl/CMakeLists.txt | 8 ++-- .../converter/parser/caffe/caffe_inspector.h | 4 ++ .../parser/caffe/caffe_model_parser.h | 4 ++ .../parser/caffe/caffe_node_parser.h | 4 ++ .../parser/caffe/caffe_node_parser_registry.h | 4 ++ .../converter/parser/onnx/onnx_model_parser.h | 4 ++ .../converter/parser/onnx/onnx_node_parser.h | 4 ++ .../converter/parser/tf/tf_model_parser.h | 5 +++ .../converter/parser/tf/tf_node_parser.h | 4 ++ .../lite/tools/converter/parser/tf/tf_util.h | 4 ++ 25 files changed, 124 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a9f0aedc22..c4763032ae0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,6 +97,14 @@ endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") add_subdirectory(mindspore/ccsrc) add_subdirectory(mindspore/core) + +if(DEFINED ENV{ENABLE_CLOUD_AND_LITE}) + set(ENABLE_CLOUD_AND_LITE $ENV{ENABLE_CLOUD_AND_LITE}) +endif() +if(ENABLE_CLOUD_AND_LITE) + add_subdirectory(mindspore/lite) +endif() + if(ENABLE_TESTCASES OR ENABLE_CPP_ST) add_subdirectory(tests) endif() diff --git a/cmake/external_libs/protobuf.cmake b/cmake/external_libs/protobuf.cmake index b67dd7b31aa..1bcfc9f15ed 100644 --- a/cmake/external_libs/protobuf.cmake +++ b/cmake/external_libs/protobuf.cmake @@ -99,7 +99,11 @@ function(common_protobuf_generate path c_var h_var) endfunction() function(ms_protobuf_generate c_var h_var) - common_protobuf_generate(${CMAKE_BINARY_DIR}/proto ${c_var} ${h_var} ${ARGN}) + if(NOT ENABLE_CLOUD_AND_LITE) + common_protobuf_generate(${CMAKE_BINARY_DIR}/proto ${c_var} ${h_var} ${ARGN}) + else() + common_protobuf_generate(${CMAKE_BINARY_DIR}/proto/lite ${c_var} ${h_var} ${ARGN}) + endif() set(${c_var} ${${c_var}} PARENT_SCOPE) set(${h_var} ${${h_var}} PARENT_SCOPE) endfunction() diff --git a/cmake/package.cmake b/cmake/package.cmake index 5797e387833..eabeac57e6d 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -283,6 +283,14 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows") ) endif() +if(ENABLE_CLOUD_AND_LITE) + install( + TARGETS mindspore-lite mslite_converter_plugin + DESTINATION ${INSTALL_LIB_DIR} + COMPONENT mindspore + ) +endif() + # set python files file(GLOB MS_PY_LIST ${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/*.py) install( diff --git a/mindspore/ccsrc/cxx_api/model/acl/acl_model_options.h b/mindspore/ccsrc/cxx_api/model/acl/acl_model_options.h index 37f49dc414e..54edfaf8e38 100644 --- a/mindspore/ccsrc/cxx_api/model/acl/acl_model_options.h +++ b/mindspore/ccsrc/cxx_api/model/acl/acl_model_options.h @@ -27,7 +27,7 @@ #include "include/api/context.h" namespace mindspore { -class AclModelOptions { +class MS_API AclModelOptions { public: explicit AclModelOptions(const std::shared_ptr &context); ~AclModelOptions() = default; diff --git a/mindspore/ccsrc/cxx_api/model/acl/model_converter.h b/mindspore/ccsrc/cxx_api/model/acl/model_converter.h index 4f97a6b161f..0788fff4371 100644 --- a/mindspore/ccsrc/cxx_api/model/acl/model_converter.h +++ b/mindspore/ccsrc/cxx_api/model/acl/model_converter.h @@ -28,7 +28,7 @@ #include "cxx_api/model/acl/acl_model_options.h" namespace mindspore { -class ModelConverter { +class MS_API ModelConverter { public: ModelConverter() : options_() {} ~ModelConverter() = default; diff --git a/mindspore/core/mindrt/src/thread/threadpool.cc b/mindspore/core/mindrt/src/thread/threadpool.cc index c9b04eda889..fb0992e1b9d 100644 --- a/mindspore/core/mindrt/src/thread/threadpool.cc +++ b/mindspore/core/mindrt/src/thread/threadpool.cc @@ -227,6 +227,10 @@ int ThreadPool::CreateThreads(size_t thread_num, const std::vector &core_li return THREAD_OK; } +int ThreadPool::ParallelLaunch(const TaskFunc &func, Content content, int task_num) const { + return ParallelLaunch(std::function(func), content, task_num); +} + int ThreadPool::ParallelLaunch(const Func &func, Content content, int task_num) const { // if single thread, run master thread if (task_num <= 1) { diff --git a/mindspore/core/mindrt/src/thread/threadpool.h b/mindspore/core/mindrt/src/thread/threadpool.h index d4a66ab893b..713e14a5e8c 100644 --- a/mindspore/core/mindrt/src/thread/threadpool.h +++ b/mindspore/core/mindrt/src/thread/threadpool.h @@ -57,11 +57,9 @@ constexpr int kThreadIdle = 2; // idle, the thread is waiting // used in scenarios with unequal division of task // the parameters indicate the start and end coefficients -#ifdef BUILD_LITE -typedef int (*Func)(void *param, int task_id, float l, float r); -#else + +typedef int (*TaskFunc)(void *param, int task_id, float l, float r); using Func = std::function; -#endif using Content = void *; typedef struct Task { @@ -164,6 +162,7 @@ class MS_CORE_API ThreadPool { int SetCpuAffinity(BindMode bind_mode); int SetProcessAffinity(BindMode bind_mode) const; + int ParallelLaunch(const TaskFunc &func, Content content, int task_num) const; int ParallelLaunch(const Func &func, Content content, int task_num) const; void DisableOccupiedActorThread() { occupied_actor_thread_ = false; } void SetActorThreadNum(size_t actor_thread_num) { actor_thread_num_ = actor_thread_num; } diff --git a/mindspore/core/utils/log_adapter.cc b/mindspore/core/utils/log_adapter.cc index 58b21e09122..f55a9ea600f 100644 --- a/mindspore/core/utils/log_adapter.cc +++ b/mindspore/core/utils/log_adapter.cc @@ -591,7 +591,7 @@ void mindspore_log_init(void) { __attribute__((constructor)) void mindspore_log_init(void) { #endif #else -void mindspore_log_init(void) { +MS_CORE_API void mindspore_log_init(void) { #endif #ifdef USE_GLOG #define google mindspore_private diff --git a/mindspore/lite/CMakeLists.txt b/mindspore/lite/CMakeLists.txt index 88509e41d89..f15c394b33d 100644 --- a/mindspore/lite/CMakeLists.txt +++ b/mindspore/lite/CMakeLists.txt @@ -12,7 +12,16 @@ set(MSLITE_GPU_BACKEND "" CACHE STRING "enable gpu backend, \ opencl only support arm64 and x86_64 , tensorrt only support x86_64, opencl/cuda/tensorrt/off") set(MSLITE_REGISTRY_DEVICE "off" CACHE STRING "Compile Mindspore Lite that supports specific devices, \ currently supported devices: Hi3516D/Hi3519A/Hi3559A/SD3403") -set(MSLITE_MINDDATA_IMPLEMENT "lite_cv" CACHE STRING "off, lite_cv, cloud, or full") +if(NOT ENABLE_CLOUD_AND_LITE) + set(MSLITE_MINDDATA_IMPLEMENT "lite_cv" CACHE STRING "off, lite_cv, cloud, or full") +else() + remove_definitions(-DUSE_GLOG) + add_compile_definitions(ENABLE_CLOUD_AND_LITE) + if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "aarch64") + set(PLATFORM_ARM64 "on") + set(MACHINE_LINUX_ARM64 "on") + endif() +endif() option(MSLITE_ENABLE_NPU "enable npu, only arm64 or arm32 support" off) option(MSLITE_ENABLE_TRAIN "enable train" on) option(MSLITE_ENABLE_SSE "enable SSE instruction set, only x86_64 support" off) @@ -486,7 +495,9 @@ include_directories(${CCSRC_DIR}/minddata/dataset) include(${TOP_DIR}/cmake/utils.cmake) include(${TOP_DIR}/cmake/dependency_utils.cmake) include(${TOP_DIR}/cmake/dependency_securec.cmake) -include(${TOP_DIR}/cmake/external_libs/flatbuffers.cmake) +if(NOT ENABLE_CLOUD_AND_LITE) + include(${TOP_DIR}/cmake/external_libs/flatbuffers.cmake) +endif() if(MSLITE_GPU_BACKEND STREQUAL opencl) include(${TOP_DIR}/cmake/external_libs/opencl.cmake) @@ -494,7 +505,9 @@ endif() if(MSLITE_ENABLE_CONVERTER OR MSLITE_MINDDATA_IMPLEMENT STREQUAL "full" OR MSLITE_MINDDATA_IMPLEMENT STREQUAL "wrapper" OR MSLITE_ENABLE_TOOLS) - include(${TOP_DIR}/cmake/external_libs/json.cmake) + if(NOT ENABLE_CLOUD_AND_LITE) + include(${TOP_DIR}/cmake/external_libs/json.cmake) + endif() endif() if(DEFINED ARCHS) @@ -576,7 +589,7 @@ if(ENABLE_MODEL_OBF) set(OBF_LIBS libmsdeobfuscator-lite.so) endif() -if(MSLITE_ENABLE_CONVERTER OR MSLITE_ENABLE_RUNTIME_GLOG) +if((MSLITE_ENABLE_CONVERTER OR MSLITE_ENABLE_RUNTIME_GLOG) AND NOT ENABLE_CLOUD_AND_LITE) include(${TOP_DIR}/cmake/external_libs/glog.cmake) endif() @@ -590,10 +603,12 @@ endfunction() if(MSLITE_ENABLE_CONVERTER) find_required_package(Patch) - include(${TOP_DIR}/cmake/external_libs/opencv.cmake) include_directories(${PYTHON_INCLUDE_DIRS}) - include(${TOP_DIR}/cmake/external_libs/eigen.cmake) - include(${TOP_DIR}/cmake/external_libs/protobuf.cmake) + if(NOT ENABLE_CLOUD_AND_LITE) + include(${TOP_DIR}/cmake/external_libs/opencv.cmake) + include(${TOP_DIR}/cmake/external_libs/eigen.cmake) + include(${TOP_DIR}/cmake/external_libs/protobuf.cmake) + endif() add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/converter) endif() @@ -604,7 +619,7 @@ if(MSLITE_ENABLE_FP16) endif() endif() -if(MSLITE_ENABLE_MODEL_ENCRYPTION) +if(MSLITE_ENABLE_MODEL_ENCRYPTION AND NOT ENABLE_CLOUD_AND_LITE) find_required_package(Patch) include(${TOP_DIR}/cmake/external_libs/openssl.cmake) add_compile_definitions(ENABLE_OPENSSL) @@ -672,9 +687,11 @@ if(ANDROID_NDK_TOOLCHAIN_INCLUDED) endif() add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src) -add_subdirectory(${CCSRC_DIR}/plugin/device/cpu/kernel/nnacl build) +if(NOT ENABLE_CLOUD_AND_LITE) + add_subdirectory(${CCSRC_DIR}/plugin/device/cpu/kernel/nnacl build) +endif() -if(MSLITE_ENABLE_TOOLS) +if(MSLITE_ENABLE_TOOLS AND NOT ENABLE_CLOUD_AND_LITE) if(NOT MSLITE_COMPILE_TWICE) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark) endif() @@ -693,7 +710,7 @@ if(NOT WIN32 AND MSLITE_ENABLE_TESTCASES) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test) endif() -if(NOT APPLE) +if(NOT APPLE AND NOT ENABLE_CLOUD_AND_LITE) include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/file_list.cmake) include(${TOP_DIR}/cmake/package_lite.cmake) endif() diff --git a/mindspore/lite/cmake/secure_option.cmake b/mindspore/lite/cmake/secure_option.cmake index 649cf35e470..9a9e4651f86 100644 --- a/mindspore/lite/cmake/secure_option.cmake +++ b/mindspore/lite/cmake/secure_option.cmake @@ -1,4 +1,4 @@ -if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") +if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND NOT ENABLE_CLOUD_AND_LITE) set(CMAKE_SKIP_RPATH TRUE) set(CMAKE_SKIP_BUILD_RPATH TRUE) set(CMAKE_SKIP_INSTALL_RPATH TRUE) diff --git a/mindspore/lite/src/CMakeLists.txt b/mindspore/lite/src/CMakeLists.txt index 6608a4dc73f..42bed4a2013 100644 --- a/mindspore/lite/src/CMakeLists.txt +++ b/mindspore/lite/src/CMakeLists.txt @@ -314,7 +314,9 @@ if(MSLITE_ENABLE_V0) endif() if(MSLITE_ENABLE_MINDRT) - add_subdirectory(${CORE_DIR}/mindrt mindspore_mindrt) + if(NOT ENABLE_CLOUD_AND_LITE) + add_subdirectory(${CORE_DIR}/mindrt mindspore_mindrt) + endif() set(LITE_SRC ${LITE_SRC} ${CMAKE_CURRENT_SOURCE_DIR}/lite_mindrt.cc ${CMAKE_CURRENT_SOURCE_DIR}/mindrt_executor.cc @@ -534,3 +536,7 @@ if(MSLITE_ENABLE_ACL) target_link_libraries(mindspore-lite ascend_kernel_mid) target_link_libraries(mindspore-lite_static ascend_kernel_mid) endif() + +if(ENABLE_CLOUD_AND_LITE) + set_target_properties(mindspore-lite PROPERTIES INSTALL_RPATH $ORIGIN) +endif() \ No newline at end of file diff --git a/mindspore/lite/src/inner_context.cc b/mindspore/lite/src/inner_context.cc index 178b224e0ca..9477d86aa0e 100644 --- a/mindspore/lite/src/inner_context.cc +++ b/mindspore/lite/src/inner_context.cc @@ -411,7 +411,7 @@ void InnerContext::ReplaceLinkInfoSenderWithNewOne(void *new_sender, void *old_s } } -int ParallelLaunch(const Context *context, const Func &func, Content content, int task_num) { +int ParallelLaunch(const Context *context, const TaskFunc &func, Content content, int task_num) { ThreadPool *pool = static_cast(context)->thread_pool(); if (pool == nullptr) { MS_LOG(ERROR) << "thread pool is nullptr"; diff --git a/mindspore/lite/src/inner_context.h b/mindspore/lite/src/inner_context.h index 433c563107a..e1547d812c0 100644 --- a/mindspore/lite/src/inner_context.h +++ b/mindspore/lite/src/inner_context.h @@ -127,7 +127,7 @@ struct InnerContext : public Context { std::unordered_map> link_info_{}; }; -int ParallelLaunch(const Context *context, const Func &func, Content content, int task_num); +int ParallelLaunch(const Context *context, const TaskFunc &func, Content content, int task_num); } // namespace mindspore::lite #endif // MINDSPORE_LITE_SRC_INNER_CONTEXT_H diff --git a/mindspore/lite/tools/common/protobuf_utils.h b/mindspore/lite/tools/common/protobuf_utils.h index 57d15407ef6..9b9583cc082 100644 --- a/mindspore/lite/tools/common/protobuf_utils.h +++ b/mindspore/lite/tools/common/protobuf_utils.h @@ -20,7 +20,11 @@ #include #include #include "google/protobuf/message.h" +#ifdef ENABLE_CLOUD_AND_LITE +#include "proto/lite/caffe.pb.h" +#else #include "proto/caffe.pb.h" +#endif #include "include/errorcode.h" #include "schema/inner/model_generated.h" diff --git a/mindspore/lite/tools/converter/CMakeLists.txt b/mindspore/lite/tools/converter/CMakeLists.txt index ff972a5db89..3d7938fa6dd 100644 --- a/mindspore/lite/tools/converter/CMakeLists.txt +++ b/mindspore/lite/tools/converter/CMakeLists.txt @@ -66,13 +66,17 @@ add_subdirectory(quantizer) add_subdirectory(registry) add_subdirectory(preprocess) add_subdirectory(config_parser) -add_subdirectory(${CORE_DIR} mindspore_core) add_subdirectory(micro/coder) +if(NOT ENABLE_CLOUD_AND_LITE) + add_subdirectory(${CORE_DIR} mindspore_core) +endif() if(MSLITE_ENABLE_ACL) set(MODE_ASCEND_ACL ON) include_directories(${TOP_DIR}/graphengine/inc/external) - include(${TOP_DIR}/cmake/dependency_graphengine.cmake) + if(NOT ENABLE_CLOUD_AND_LITE) + include(${TOP_DIR}/cmake/dependency_graphengine.cmake) + endif() add_subdirectory(adapter/acl) link_directories(${ASCEND_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH} ${ASCEND_CANN_RUNTIME_PATH}) endif() @@ -228,6 +232,9 @@ add_executable(converter_lite ${LITE_SRC} ) add_dependencies(converter_lite fbs_src fbs_inner_src) +if(NOT ENABLE_CLOUD_AND_LITE) + add_dependencies(converter_lite nnacl_mid) +endif() if((NOT WIN32) AND MSLITE_ENABLE_DPICO_ATC_ADAPTER) add_dependencies(converter_lite dpico_atc_adapter) endif() diff --git a/mindspore/lite/tools/converter/adapter/acl/CMakeLists.txt b/mindspore/lite/tools/converter/adapter/acl/CMakeLists.txt index e9a4053db0b..0bc218bdf02 100644 --- a/mindspore/lite/tools/converter/adapter/acl/CMakeLists.txt +++ b/mindspore/lite/tools/converter/adapter/acl/CMakeLists.txt @@ -22,13 +22,15 @@ file(GLOB ACL_SRC set(ENABLE_ACL on) set(MODE_ASCEND_ACL off) - -add_subdirectory(${TOP_DIR}/mindspore/ccsrc/transform/graph_ir _mindspore_transform_graph_ir_obj) -add_subdirectory(${TOP_DIR}/mindspore/ccsrc/cxx_api mindspore_shared_lib) +if(NOT ENABLE_CLOUD_AND_LITE) + add_subdirectory(${TOP_DIR}/mindspore/ccsrc/transform/graph_ir _mindspore_transform_graph_ir_obj) + add_subdirectory(${TOP_DIR}/mindspore/ccsrc/cxx_api mindspore_shared_lib) +endif() set_property(SOURCE ${ACL_SRC} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_LITE) add_library(lite_acl_mid OBJECT ${ACL_SRC}) target_link_libraries(lite_acl_mid mindspore_shared_lib) +add_dependencies(lite_acl_mid mindspore_shared_lib) add_dependencies(lite_acl_mid fbs_inner_src) if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "cloud") diff --git a/mindspore/lite/tools/converter/parser/caffe/caffe_inspector.h b/mindspore/lite/tools/converter/parser/caffe/caffe_inspector.h index 76432e7b4de..f5a9bc4007a 100644 --- a/mindspore/lite/tools/converter/parser/caffe/caffe_inspector.h +++ b/mindspore/lite/tools/converter/parser/caffe/caffe_inspector.h @@ -22,7 +22,11 @@ #include #include #include +#ifdef ENABLE_CLOUD_AND_LITE +#include "proto/lite/caffe.pb.h" +#else #include "proto/caffe.pb.h" +#endif #include "include/errorcode.h" namespace mindspore { diff --git a/mindspore/lite/tools/converter/parser/caffe/caffe_model_parser.h b/mindspore/lite/tools/converter/parser/caffe/caffe_model_parser.h index 8e1f97cbc32..29c3fe0caea 100644 --- a/mindspore/lite/tools/converter/parser/caffe/caffe_model_parser.h +++ b/mindspore/lite/tools/converter/parser/caffe/caffe_model_parser.h @@ -23,7 +23,11 @@ #include #include "include/registry/model_parser.h" #include "include/registry/model_parser_registry.h" +#ifdef ENABLE_CLOUD_AND_LITE +#include "proto/lite/caffe.pb.h" +#else #include "proto/caffe.pb.h" +#endif #include "ops/primitive_c.h" using STATUS = int; diff --git a/mindspore/lite/tools/converter/parser/caffe/caffe_node_parser.h b/mindspore/lite/tools/converter/parser/caffe/caffe_node_parser.h index 99589ec1824..9a78135e3dd 100644 --- a/mindspore/lite/tools/converter/parser/caffe/caffe_node_parser.h +++ b/mindspore/lite/tools/converter/parser/caffe/caffe_node_parser.h @@ -21,7 +21,11 @@ #include #include "google/protobuf/message.h" #include "schema/inner/model_generated.h" +#ifdef ENABLE_CLOUD_AND_LITE +#include "proto/lite/caffe.pb.h" +#else #include "proto/caffe.pb.h" +#endif #include "tools/converter/parser/caffe/caffe_node_parser.h" #include "include/errorcode.h" #include "src/common/log_adapter.h" diff --git a/mindspore/lite/tools/converter/parser/caffe/caffe_node_parser_registry.h b/mindspore/lite/tools/converter/parser/caffe/caffe_node_parser_registry.h index 1c1b844341b..c61993ab6c8 100644 --- a/mindspore/lite/tools/converter/parser/caffe/caffe_node_parser_registry.h +++ b/mindspore/lite/tools/converter/parser/caffe/caffe_node_parser_registry.h @@ -20,7 +20,11 @@ #include #include #include "tools/converter/parser/caffe/caffe_node_parser.h" +#ifdef ENABLE_CLOUD_AND_LITE +#include "proto/lite/caffe.pb.h" +#else #include "proto/caffe.pb.h" +#endif namespace mindspore::lite { class CaffeNodeParserRegistry { diff --git a/mindspore/lite/tools/converter/parser/onnx/onnx_model_parser.h b/mindspore/lite/tools/converter/parser/onnx/onnx_model_parser.h index 02cd8ff82a3..de63874e539 100644 --- a/mindspore/lite/tools/converter/parser/onnx/onnx_model_parser.h +++ b/mindspore/lite/tools/converter/parser/onnx/onnx_model_parser.h @@ -30,7 +30,11 @@ #include "include/registry/model_parser.h" #include "include/registry/model_parser_registry.h" #include "tools/converter/parser/onnx/onnx_node_parser_registry.h" +#ifdef ENABLE_CLOUD_AND_LITE +#include "proto/lite/onnx.pb.h" +#else #include "proto/onnx.pb.h" +#endif #include "schema/inner/model_generated.h" namespace mindspore { diff --git a/mindspore/lite/tools/converter/parser/onnx/onnx_node_parser.h b/mindspore/lite/tools/converter/parser/onnx/onnx_node_parser.h index 38fcd782776..1aee383d56b 100644 --- a/mindspore/lite/tools/converter/parser/onnx/onnx_node_parser.h +++ b/mindspore/lite/tools/converter/parser/onnx/onnx_node_parser.h @@ -21,7 +21,11 @@ #include #include #include "google/protobuf/message.h" +#ifdef ENABLE_CLOUD_AND_LITE +#include "proto/lite/onnx.pb.h" +#else #include "proto/onnx.pb.h" +#endif #include "include/errorcode.h" #include "src/common/log_adapter.h" #include "schema/inner/model_generated.h" diff --git a/mindspore/lite/tools/converter/parser/tf/tf_model_parser.h b/mindspore/lite/tools/converter/parser/tf/tf_model_parser.h index f8dbf604511..bf86925215f 100644 --- a/mindspore/lite/tools/converter/parser/tf/tf_model_parser.h +++ b/mindspore/lite/tools/converter/parser/tf/tf_model_parser.h @@ -24,8 +24,13 @@ #include #include #include +#ifdef ENABLE_CLOUD_AND_LITE +#include "proto/lite/graph.pb.h" +#include "proto/lite/node_def.pb.h" +#else #include "proto/graph.pb.h" #include "proto/node_def.pb.h" +#endif #include "schema/inner/model_generated.h" #include "securec/include/securec.h" #include "tools/common/tensor_util.h" diff --git a/mindspore/lite/tools/converter/parser/tf/tf_node_parser.h b/mindspore/lite/tools/converter/parser/tf/tf_node_parser.h index f9e6a5ce142..78d9143c244 100644 --- a/mindspore/lite/tools/converter/parser/tf/tf_node_parser.h +++ b/mindspore/lite/tools/converter/parser/tf/tf_node_parser.h @@ -22,7 +22,11 @@ #include #include #include "tools/converter/parser/tf/tf_util.h" +#ifdef ENABLE_CLOUD_AND_LITE +#include "proto/lite/graph.pb.h" +#else #include "proto/graph.pb.h" +#endif #include "ops/primitive_c.h" #include "mindspore/core/utils/check_convert_utils.h" #include "nnacl/op_base.h" diff --git a/mindspore/lite/tools/converter/parser/tf/tf_util.h b/mindspore/lite/tools/converter/parser/tf/tf_util.h index 1a30ee78b5b..ef023ee5981 100644 --- a/mindspore/lite/tools/converter/parser/tf/tf_util.h +++ b/mindspore/lite/tools/converter/parser/tf/tf_util.h @@ -19,7 +19,11 @@ #include #include +#ifdef ENABLE_CLOUD_AND_LITE +#include "proto/lite/node_def.pb.h" +#else #include "proto/node_def.pb.h" +#endif #include "ir/dtype/type_id.h" #include "include/errorcode.h" #include "schema/inner/model_generated.h"