forked from OSSInnovation/mindspore
!6752 change lite log_adapter
Merge pull request !6752 from yeyunpeng2020/log
This commit is contained in:
commit
3cf6cb6ddb
4
build.sh
4
build.sh
|
@ -652,7 +652,7 @@ build_lite()
|
|||
checkndk
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" -DANDROID_NATIVE_API_LEVEL="19" \
|
||||
-DANDROID_NDK="${ANDROID_NDK}" -DANDROID_ABI="arm64-v8a" -DANDROID_TOOLCHAIN_NAME="aarch64-linux-android-clang" \
|
||||
-DANDROID_STL="c++_shared" -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DSUPPORT_TRAIN=${SUPPORT_TRAIN} \
|
||||
-DANDROID_STL="c++_static" -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DSUPPORT_TRAIN=${SUPPORT_TRAIN} \
|
||||
-DBUILD_DEVICE=on -DPLATFORM_ARM64=on -DBUILD_CONVERTER=off -DENABLE_NEON=on -DENABLE_FP16="off" \
|
||||
-DSUPPORT_GPU=${ENABLE_GPU} -DOFFLINE_COMPILE=${OPENCL_OFFLINE_COMPILE} -DBUILD_MINDDATA=${COMPILE_MINDDATA_LITE} \
|
||||
-DCMAKE_INSTALL_PREFIX=${BASEPATH}/output/tmp -DMS_VERSION_MAJOR=${VERSION_MAJOR} \
|
||||
|
@ -662,7 +662,7 @@ build_lite()
|
|||
checkndk
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" -DANDROID_NATIVE_API_LEVEL="19" \
|
||||
-DANDROID_NDK="${ANDROID_NDK}" -DANDROID_ABI="armeabi-v7a" -DANDROID_TOOLCHAIN_NAME="clang" \
|
||||
-DANDROID_STL="c++_shared" -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
||||
-DANDROID_STL="c++_static" -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
||||
-DBUILD_DEVICE=on -DPLATFORM_ARM32=on -DENABLE_NEON=on -DSUPPORT_TRAIN=${SUPPORT_TRAIN} -DBUILD_CONVERTER=off \
|
||||
-DSUPPORT_GPU=${ENABLE_GPU} -DOFFLINE_COMPILE=${OPENCL_OFFLINE_COMPILE} -DBUILD_MINDDATA=${COMPILE_MINDDATA_LITE} \
|
||||
-DCMAKE_INSTALL_PREFIX=${BASEPATH}/output/tmp -DMS_VERSION_MAJOR=${VERSION_MAJOR} \
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
// namespace to support utils module definition
|
||||
namespace mindspore {
|
||||
#ifndef USE_ANDROID_LOG
|
||||
#ifdef USE_GLOG
|
||||
static std::string GetTime() {
|
||||
#define BUFLEN 80
|
||||
|
@ -126,7 +125,6 @@ static int GetSlogLevel(MsLogLevel level) {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static std::string ExceptionTypeToString(ExceptionType type) {
|
||||
#define _TO_STRING(x) #x
|
||||
|
@ -182,30 +180,13 @@ static const char *GetSubModuleName(SubModuleId module_id) {
|
|||
"UTILS", // SM_UTILS
|
||||
"VM", // SM_VM
|
||||
"PROFILER", // SM_PROFILER
|
||||
"PS" // SM_PS
|
||||
"PS", // SM_PS
|
||||
"LITE" // SM_LITE
|
||||
};
|
||||
|
||||
return sub_module_names[module_id % NUM_SUBMODUES];
|
||||
}
|
||||
|
||||
const char *EnumStrForMsLogLevel(MsLogLevel level) {
|
||||
if (level == DEBUG) {
|
||||
return "DEBUG";
|
||||
} else if (level == INFO) {
|
||||
return "INFO";
|
||||
} else if (level == WARNING) {
|
||||
return "WARNING";
|
||||
} else if (level == ERROR) {
|
||||
return "ERROR";
|
||||
} else if (level == EXCEPTION) {
|
||||
return "EXCEPTION";
|
||||
} else {
|
||||
return "NO_LEVEL";
|
||||
}
|
||||
}
|
||||
|
||||
void LogWriter::OutputLog(const std::ostringstream &msg) const {
|
||||
#ifndef USE_ANDROID_LOG
|
||||
#ifdef USE_GLOG
|
||||
auto submodule_name = GetSubModuleName(submodule_);
|
||||
google::LogMessage("", 0, GetGlogLevel(log_level_)).stream()
|
||||
|
@ -218,10 +199,6 @@ void LogWriter::OutputLog(const std::ostringstream &msg) const {
|
|||
Dlog(static_cast<int>(slog_module_id), GetSlogLevel(log_level_), "[%s:%d] %s] %s", location_.file_, location_.line_,
|
||||
location_.func_, str_msg.c_str());
|
||||
#endif
|
||||
#else
|
||||
printf("%s [%s:%d] %s] %s\n:", EnumStrForMsLogLevel(log_level_), location_.file_, location_.line_, location_.func_,
|
||||
msg.str().c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
void LogWriter::operator<(const LogStream &stream) const noexcept {
|
||||
|
|
|
@ -25,13 +25,11 @@
|
|||
#include <functional>
|
||||
#include "utils/overload.h"
|
||||
#include "./securec.h"
|
||||
#ifndef USE_ANDROID_LOG
|
||||
#ifdef USE_GLOG
|
||||
#include "glog/logging.h"
|
||||
#else
|
||||
#include "toolchain/slog.h"
|
||||
#endif
|
||||
#endif
|
||||
// NOTICE: when relative path of 'log_adapter.h' changed, macro 'LOG_HDR_FILE_REL_PATH' must be changed
|
||||
#define LOG_HDR_FILE_REL_PATH "mindspore/core/utils/log_adapter.h"
|
||||
|
||||
|
@ -126,6 +124,7 @@ enum SubModuleId : int {
|
|||
SM_VM, // VM
|
||||
SM_PROFILER, // profiler
|
||||
SM_PS, // Parameter Server
|
||||
SM_LITE, // LITE
|
||||
NUM_SUBMODUES // number of submodules
|
||||
};
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@ option(OFFLINE_COMPILE "if offline compile OpenCL kernel" off)
|
|||
set(BUILD_MINDDATA "off" CACHE STRING "off, lite, lite_cv or full")
|
||||
option(BUILD_MINDDATA_EXAMPLE "" on)
|
||||
option(ENABLE_VERBOSE "" off)
|
||||
add_compile_definitions(USE_ANDROID_LOG)
|
||||
add_compile_definitions(NO_DLIB)
|
||||
add_compile_options(-fPIC)
|
||||
string(REPLACE "-g" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <asm/hwcap.h>
|
||||
#include "nnacl/nnacl_utils.h"
|
||||
#endif
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
|
||||
#define OPTIMIZE_SHARED_LIBRARY_PATH "libmindspore-lite-optimize.so"
|
||||
#define FLOAT16_SHARED_LIBRARY_PATH "libmindspore-lite-fp16.so"
|
||||
|
|
|
@ -1,20 +1,23 @@
|
|||
|
||||
add_compile_definitions(USE_ANDROID_LOG)
|
||||
set(LITE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
include_directories(${LITE_DIR}/nnacl/)
|
||||
include_directories(${LITE_DIR}/nnacl/optimize)
|
||||
|
||||
if (PLATFORM_ARM32 OR PLATFORM_ARM64)
|
||||
#for performance
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
#- fno - rtti - fno - exceptions
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -ffast-math")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -ffast-math")
|
||||
endif()
|
||||
#for performance
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
if (SUPPORT_GPU)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -ffast-math -fno-rtti")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -ffast-math -fno-rtti")
|
||||
else ()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -ffast-math -fno-rtti -fno-exceptions")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -ffast-math -fno-rtti -fno-exceptions")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set(LITE_SRC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/common/graph_util.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../core/gvar/logging_level.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/common/log_adapter.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/runtime/allocator.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/runtime/runtime_api.cc
|
||||
|
@ -29,24 +32,24 @@ set(LITE_SRC
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/scheduler.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lite_session.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/model.cc
|
||||
)
|
||||
)
|
||||
|
||||
if (SUPPORT_GPU)
|
||||
set(LITE_SRC
|
||||
${LITE_SRC}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/runtime/kernel/opencl/subgraph_opencl_kernel.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/runtime/kernel/opencl/utils.cc
|
||||
${LITE_SRC}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/runtime/kernel/opencl/subgraph_opencl_kernel.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/runtime/kernel/opencl/utils.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/runtime/opencl/opencl_executor.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/runtime/opencl/opencl_allocator.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/runtime/opencl/opencl_runtime.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/runtime/opencl/opencl_wrapper.cc
|
||||
)
|
||||
endif()
|
||||
)
|
||||
endif ()
|
||||
|
||||
|
||||
if (SUPPORT_TRAIN)
|
||||
set(ANF_SRC
|
||||
${ANF_SRC}
|
||||
${ANF_SRC}
|
||||
)
|
||||
set(PASS_SRC)
|
||||
set(LITE_SRC
|
||||
|
@ -71,56 +74,56 @@ set_target_properties(mindspore-lite_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
|||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field")
|
||||
if (SUPPORT_GPU)
|
||||
add_subdirectory(runtime/kernel/opencl)
|
||||
target_link_libraries(mindspore-lite cpu_kernel_mid opencl_kernel_mid nnacl)
|
||||
target_link_libraries(mindspore-lite_static cpu_kernel_mid opencl_kernel_mid nnacl)
|
||||
add_subdirectory(runtime/kernel/opencl)
|
||||
target_link_libraries(mindspore-lite cpu_kernel_mid opencl_kernel_mid nnacl)
|
||||
target_link_libraries(mindspore-lite_static cpu_kernel_mid opencl_kernel_mid nnacl)
|
||||
else ()
|
||||
target_link_libraries(mindspore-lite cpu_kernel_mid nnacl)
|
||||
target_link_libraries(mindspore-lite_static cpu_kernel_mid nnacl)
|
||||
target_link_libraries(mindspore-lite cpu_kernel_mid nnacl)
|
||||
target_link_libraries(mindspore-lite_static cpu_kernel_mid nnacl)
|
||||
endif ()
|
||||
if (PLATFORM_ARM32 OR PLATFORM_ARM64)
|
||||
target_link_libraries(mindspore-lite log)
|
||||
target_link_libraries(mindspore-lite log)
|
||||
endif ()
|
||||
if (BUILD_MINDDATA STREQUAL "lite")
|
||||
target_link_libraries(mindspore-lite minddata_eager_mid minddata-lite)
|
||||
target_link_libraries(mindspore-lite_static minddata_eager_mid)
|
||||
target_link_libraries(mindspore-lite minddata_eager_mid minddata-lite)
|
||||
target_link_libraries(mindspore-lite_static minddata_eager_mid)
|
||||
endif ()
|
||||
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND (PLATFORM_ARM64 OR PLATFORM_ARM32))
|
||||
add_custom_command(TARGET mindspore-lite POST_BUILD
|
||||
COMMAND ${ANDROID_NDK}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/aarch64-linux-android/bin/strip
|
||||
${TOP_DIR}/mindspore/lite/build/src/libmindspore-lite.so)
|
||||
add_custom_command(TARGET mindspore-lite POST_BUILD
|
||||
COMMAND ${ANDROID_NDK}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/aarch64-linux-android/bin/strip
|
||||
${TOP_DIR}/mindspore/lite/build/src/libmindspore-lite.so)
|
||||
endif ()
|
||||
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
if (PLATFORM_ARM64 OR PLATFORM_ARM32)
|
||||
add_custom_command(TARGET mindspore-lite POST_BUILD
|
||||
COMMAND ${ANDROID_NDK}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/aarch64-linux-android/bin/strip
|
||||
${CMAKE_BINARY_DIR}/src/libmindspore-lite.so)
|
||||
elseif (NOT WIN32)
|
||||
add_custom_command(TARGET mindspore-lite POST_BUILD
|
||||
COMMAND strip ${CMAKE_BINARY_DIR}/src/libmindspore-lite.so)
|
||||
endif ()
|
||||
if (PLATFORM_ARM64 OR PLATFORM_ARM32)
|
||||
add_custom_command(TARGET mindspore-lite POST_BUILD
|
||||
COMMAND ${ANDROID_NDK}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/aarch64-linux-android/bin/strip
|
||||
${CMAKE_BINARY_DIR}/src/libmindspore-lite.so)
|
||||
elseif (NOT WIN32)
|
||||
add_custom_command(TARGET mindspore-lite POST_BUILD
|
||||
COMMAND strip ${CMAKE_BINARY_DIR}/src/libmindspore-lite.so)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
########################## build optimize and float16 library #################################3
|
||||
if (PLATFORM_ARM64)
|
||||
add_library(mindspore-lite-optimize SHARED)
|
||||
target_link_libraries(mindspore-lite-optimize cpu_opt_kernel_mid)
|
||||
target_link_libraries(mindspore-lite-optimize nnacl_optimize)
|
||||
add_library(mindspore-lite-optimize SHARED)
|
||||
target_link_libraries(mindspore-lite-optimize cpu_opt_kernel_mid)
|
||||
target_link_libraries(mindspore-lite-optimize nnacl_optimize)
|
||||
|
||||
add_library(mindspore-lite-fp16 SHARED)
|
||||
target_link_libraries(mindspore-lite-fp16 cpu_fp16_kernel_mid)
|
||||
target_link_libraries(mindspore-lite-fp16 nnacl_fp16)
|
||||
add_library(mindspore-lite-fp16 SHARED)
|
||||
target_link_libraries(mindspore-lite-fp16 cpu_fp16_kernel_mid)
|
||||
target_link_libraries(mindspore-lite-fp16 nnacl_fp16)
|
||||
endif ()
|
||||
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND (PLATFORM_ARM64))
|
||||
add_custom_command(TARGET mindspore-lite-optimize POST_BUILD COMMAND
|
||||
${ANDROID_NDK}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/aarch64-linux-android/bin/strip
|
||||
${TOP_DIR}/mindspore/lite/build/src/libmindspore-lite-optimize.so)
|
||||
add_custom_command(TARGET mindspore-lite-optimize POST_BUILD COMMAND
|
||||
${ANDROID_NDK}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/aarch64-linux-android/bin/strip
|
||||
${TOP_DIR}/mindspore/lite/build/src/libmindspore-lite-optimize.so)
|
||||
|
||||
add_custom_command(TARGET mindspore-lite-fp16 POST_BUILD COMMAND
|
||||
${ANDROID_NDK}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/aarch64-linux-android/bin/strip
|
||||
${TOP_DIR}/mindspore/lite/build/src/libmindspore-lite-fp16.so)
|
||||
add_custom_command(TARGET mindspore-lite-fp16 POST_BUILD COMMAND
|
||||
${ANDROID_NDK}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/aarch64-linux-android/bin/strip
|
||||
${TOP_DIR}/mindspore/lite/build/src/libmindspore-lite-fp16.so)
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <memory>
|
||||
#include <fstream>
|
||||
#include "src/common/utils.h"
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace lite {
|
||||
|
|
|
@ -22,6 +22,6 @@ namespace mindspore {
|
|||
namespace lite {
|
||||
int CompareRelativeOutput(float *output_data, std::string file_path);
|
||||
float RelativeOutputError(float *output_data, std::string file_path);
|
||||
}
|
||||
} // namespace lite
|
||||
} // namespace mindspore
|
||||
#endif // MINDSPORE_LITE_COMMON_FILE_UTILS_EXT_H_
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <utility>
|
||||
#include "src/common/graph_util.h"
|
||||
#include "src/common/utils.h"
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
#include "include/errorcode.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <vector>
|
||||
#include <memory>
|
||||
#include "schema/model_generated.h"
|
||||
#include "utils//log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
#include "include/errorcode.h"
|
||||
#include "include/model.h"
|
||||
|
||||
|
|
|
@ -1,149 +0,0 @@
|
|||
/**
|
||||
* Copyright 2020 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "ir/graph_utils.h"
|
||||
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
#include "ir/visitor.h"
|
||||
#include "ir/func_graph.h"
|
||||
#include "utils/label.h"
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/utils.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace {
|
||||
class DeepFirstSearcher {
|
||||
public:
|
||||
explicit DeepFirstSearcher(const IncludeFunc &include) : include_(include) {}
|
||||
~DeepFirstSearcher() = default;
|
||||
|
||||
std::vector<AnfNodePtr> Search(const AnfNodePtr &root) {
|
||||
if (root == nullptr) {
|
||||
return res_;
|
||||
}
|
||||
seen_ = NewSeenGeneration();
|
||||
Visit(root);
|
||||
return res_;
|
||||
}
|
||||
|
||||
void Visit(const AnfNodePtr &node) {
|
||||
if (node == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (node->seen_ == seen_) {
|
||||
return;
|
||||
}
|
||||
|
||||
node->seen_ = seen_;
|
||||
|
||||
auto incl = include_(node);
|
||||
if (incl == EXCLUDE) {
|
||||
return;
|
||||
}
|
||||
if (filter_ == nullptr || !filter_(node)) {
|
||||
res_.push_back(node);
|
||||
}
|
||||
if (incl == FOLLOW) {
|
||||
if (node->isa<CNode>()) {
|
||||
auto cnode = node->cast<CNodePtr>();
|
||||
auto &inputs = cnode->inputs();
|
||||
for (auto iter = inputs.rbegin(); iter != inputs.rend(); ++iter) {
|
||||
Visit(*iter);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
size_t seen_{0};
|
||||
IncludeFunc include_;
|
||||
FilterFunc filter_;
|
||||
std::vector<AnfNodePtr> res_{};
|
||||
};
|
||||
|
||||
class DeepScopedGraphSearcher : public DeepFirstSearcher {
|
||||
public:
|
||||
explicit DeepScopedGraphSearcher(const IncludeFunc &include) : DeepFirstSearcher(include) {}
|
||||
~DeepScopedGraphSearcher() = default;
|
||||
|
||||
void Visit(const CNodePtr &cnode) { return; }
|
||||
|
||||
void Visit(const ValueNodePtr &vnode) {
|
||||
if (!IsValueNode<FuncGraph>(vnode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto graph = GetValueNode<FuncGraphPtr>(vnode);
|
||||
AnfNodePtr ret = graph->get_return();
|
||||
if (ret != nullptr) {
|
||||
DeepFirstSearcher::Visit(ret);
|
||||
}
|
||||
}
|
||||
|
||||
void Visit(const ParameterPtr ¶m) {
|
||||
if (param->func_graph() == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
AnfNodePtr ret = param->func_graph()->get_return();
|
||||
if (ret != nullptr) {
|
||||
DeepFirstSearcher::Visit(ret);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class DeepUsedGraphSearcher : public DeepFirstSearcher {
|
||||
public:
|
||||
explicit DeepUsedGraphSearcher(const IncludeFunc &include) : DeepFirstSearcher(include) {}
|
||||
~DeepUsedGraphSearcher() = default;
|
||||
|
||||
void Visit(const CNodePtr &cnode) { return; }
|
||||
|
||||
void Visit(const ValueNodePtr &vnode) { return; }
|
||||
};
|
||||
|
||||
class DeepLinkedGraphSearcher : public DeepFirstSearcher {
|
||||
public:
|
||||
explicit DeepLinkedGraphSearcher(const IncludeFunc &include) : DeepFirstSearcher(include) {}
|
||||
~DeepLinkedGraphSearcher() = default;
|
||||
|
||||
void Visit(const CNodePtr &cnode) { return; }
|
||||
|
||||
void Visit(const ValueNodePtr &) {}
|
||||
};
|
||||
} // namespace
|
||||
|
||||
std::vector<AnfNodePtr> DeepScopedGraphSearch(const AnfNodePtr &root, const IncludeFunc &include) {
|
||||
return DeepScopedGraphSearcher(include).Search(root);
|
||||
}
|
||||
|
||||
std::vector<AnfNodePtr> DeepUsedGraphSearch(const AnfNodePtr &root, const IncludeFunc &include) {
|
||||
return DeepUsedGraphSearcher(include).Search(root);
|
||||
}
|
||||
|
||||
std::vector<AnfNodePtr> DeepLinkedGraphSearch(const AnfNodePtr &root, const IncludeFunc &include) {
|
||||
return DeepLinkedGraphSearcher(include).Search(root);
|
||||
}
|
||||
} // namespace mindspore
|
|
@ -14,12 +14,10 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "utils/log_adapter.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include <stdio.h>
|
||||
#include "src/common/log_adapter.h"
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
|
||||
#ifdef ENABLE_ARM
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
@ -29,19 +27,19 @@ namespace mindspore {
|
|||
constexpr const char *ANDROID_LOG_TAG = "MS_LITE";
|
||||
|
||||
int EnvToInt(const char *env) {
|
||||
if (env == nullptr) return -1;
|
||||
if (strcmp(env, "DEBUG") == 0) return 0;
|
||||
if (strcmp(env, "INFO") == 0) return 1;
|
||||
if (strcmp(env, "WARNING") == 0) return 2;
|
||||
if (strcmp(env, "ERROR") == 0) return 3;
|
||||
return -1;
|
||||
if (env == nullptr) return 2;
|
||||
if (strcmp(env, "0") == 0) return 0;
|
||||
if (strcmp(env, "1") == 0) return 1;
|
||||
if (strcmp(env, "2") == 0) return 2;
|
||||
if (strcmp(env, "3") == 0) return 3;
|
||||
return 2;
|
||||
}
|
||||
|
||||
bool IsPrint(int level) {
|
||||
static const char *env = std::getenv("MSLOG");
|
||||
static const char *env = std::getenv("GLOG_v");
|
||||
static int ms_level = EnvToInt(env);
|
||||
if (ms_level < 0) {
|
||||
ms_level = 2;
|
||||
if (level < 0) {
|
||||
level = 2;
|
||||
}
|
||||
return level >= ms_level;
|
||||
}
|
||||
|
@ -72,50 +70,19 @@ const char *EnumStrForMsLogLevel(MsLogLevel level) {
|
|||
return "WARNING";
|
||||
} else if (level == ERROR) {
|
||||
return "ERROR";
|
||||
} else if (level == EXCEPTION) {
|
||||
return "EXCEPTION";
|
||||
} else {
|
||||
return "NO_LEVEL";
|
||||
}
|
||||
}
|
||||
|
||||
static std::string ExceptionTypeToString(ExceptionType type) {
|
||||
#define _TO_STRING(x) #x
|
||||
// clang-format off
|
||||
static const char *const type_names[] = {
|
||||
_TO_STRING(NoExceptionType),
|
||||
_TO_STRING(UnknownError),
|
||||
_TO_STRING(ArgumentError),
|
||||
_TO_STRING(NotSupportError),
|
||||
_TO_STRING(NotExistsError),
|
||||
_TO_STRING(AlreadyExistsError),
|
||||
_TO_STRING(UnavailableError),
|
||||
_TO_STRING(DeviceProcessError),
|
||||
_TO_STRING(AbortedError),
|
||||
_TO_STRING(TimeOutError),
|
||||
_TO_STRING(ResourceUnavailable),
|
||||
_TO_STRING(NoPermissionError),
|
||||
_TO_STRING(IndexError),
|
||||
_TO_STRING(ValueError),
|
||||
_TO_STRING(TypeError),
|
||||
_TO_STRING(AttributeError),
|
||||
};
|
||||
// clang-format on
|
||||
#undef _TO_STRING
|
||||
if (type < UnknownError || type > AttributeError) {
|
||||
type = UnknownError;
|
||||
}
|
||||
return std::string(type_names[type]);
|
||||
}
|
||||
|
||||
void LogWriter::OutputLog(const std::ostringstream &msg) const {
|
||||
if (IsPrint(log_level_) && submodule_ != SM_UNKNOWN) {
|
||||
if (IsPrint(log_level_)) {
|
||||
#ifdef ENABLE_ARM
|
||||
__android_log_print(GetAndroidLogLevel(log_level_), ANDROID_LOG_TAG, "[%s:%d] %s] %s", location_.file_,
|
||||
location_.line_, location_.func_, msg.str().c_str());
|
||||
#else
|
||||
printf("%s [%s:%d] %s] %s\n", EnumStrForMsLogLevel(log_level_), location_.file_, location_.line_,
|
||||
location_.func_, msg.str().c_str());
|
||||
printf("%s [%s:%d] %s] %s\n", EnumStrForMsLogLevel(log_level_), location_.file_, location_.line_, location_.func_,
|
||||
msg.str().c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -125,27 +92,4 @@ void LogWriter::operator<(const LogStream &stream) const noexcept {
|
|||
msg << stream.sstream_->rdbuf();
|
||||
OutputLog(msg);
|
||||
}
|
||||
|
||||
void LogWriter::operator^(const LogStream &stream) const {
|
||||
std::ostringstream msg;
|
||||
msg << stream.sstream_->rdbuf();
|
||||
OutputLog(msg);
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << location_.file_ << ":" << location_.line_ << " " << location_.func_ << "] ";
|
||||
if (exception_type_ != NoExceptionType && exception_type_ != IndexError && exception_type_ != TypeError &&
|
||||
exception_type_ != ValueError && exception_type_ != AttributeError) {
|
||||
oss << ExceptionTypeToString(exception_type_) << " ";
|
||||
}
|
||||
oss << msg.str();
|
||||
|
||||
if (trace_provider_ != nullptr) {
|
||||
trace_provider_(oss);
|
||||
}
|
||||
|
||||
if (exception_handler_ != nullptr) {
|
||||
exception_handler_(exception_type_, oss.str());
|
||||
}
|
||||
throw std::runtime_error(oss.str());
|
||||
}
|
||||
} // namespace mindspore
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
/**
|
||||
* Copyright 2019 Huawei Technologies Co., Ltd
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef MINDSPORE_LITE_COMMON_LOG_ADAPTER_H_
|
||||
#define MINDSPORE_LITE_COMMON_LOG_ADAPTER_H_
|
||||
#ifdef USE_GLOG
|
||||
#include "utils/log_adapter.h"
|
||||
#else
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include "utils/overload.h"
|
||||
// NOTICE: when relative path of 'log_adapter.h' changed, macro 'LOG_HEAR_FILE_REL_PATH' must be changed
|
||||
#define LOG_HEAR_FILE_REL_PATH "mindspore/lite/src/common/log_adapter.h"
|
||||
|
||||
// Get start index of file relative path in __FILE__
|
||||
static constexpr int GetRealPathPos() noexcept {
|
||||
return sizeof(__FILE__) > sizeof(LOG_HEAR_FILE_REL_PATH) ? sizeof(__FILE__) - sizeof(LOG_HEAR_FILE_REL_PATH) : 0;
|
||||
}
|
||||
|
||||
namespace mindspore {
|
||||
#define FILE_NAME \
|
||||
(sizeof(__FILE__) > GetRealPathPos() ? static_cast<const char *>(__FILE__) + GetRealPathPos() \
|
||||
: static_cast<const char *>(__FILE__))
|
||||
|
||||
struct LocationInfo {
|
||||
LocationInfo(const char *file, int line, const char *func) : file_(file), line_(line), func_(func) {}
|
||||
|
||||
~LocationInfo() = default;
|
||||
|
||||
const char *file_;
|
||||
int line_;
|
||||
const char *func_;
|
||||
};
|
||||
|
||||
class LogStream {
|
||||
public:
|
||||
LogStream() { sstream_ = std::make_shared<std::stringstream>(); }
|
||||
|
||||
~LogStream() = default;
|
||||
|
||||
template <typename T>
|
||||
LogStream &operator<<(const T &val) noexcept {
|
||||
(*sstream_) << val;
|
||||
return *this;
|
||||
}
|
||||
|
||||
LogStream &operator<<(std::ostream &func(std::ostream &os)) noexcept {
|
||||
(*sstream_) << func;
|
||||
return *this;
|
||||
}
|
||||
friend class LogWriter;
|
||||
|
||||
private:
|
||||
std::shared_ptr<std::stringstream> sstream_;
|
||||
};
|
||||
|
||||
enum MsLogLevel : int { DEBUG = 0, INFO, WARNING, ERROR };
|
||||
|
||||
const char *EnumStrForMsLogLevel(MsLogLevel level);
|
||||
|
||||
class LogWriter {
|
||||
public:
|
||||
LogWriter(const LocationInfo &location, MsLogLevel log_level) : location_(location), log_level_(log_level) {}
|
||||
|
||||
~LogWriter() = default;
|
||||
|
||||
void operator<(const LogStream &stream) const noexcept __attribute__((visibility("default")));
|
||||
|
||||
private:
|
||||
void OutputLog(const std::ostringstream &msg) const;
|
||||
|
||||
LocationInfo location_;
|
||||
MsLogLevel log_level_;
|
||||
};
|
||||
|
||||
#define MSLOG_IF(level) \
|
||||
mindspore::LogWriter(mindspore::LocationInfo(FILE_NAME, __LINE__, __FUNCTION__), level) < mindspore::LogStream()
|
||||
|
||||
#define MS_LOG(level) MS_LOG_##level
|
||||
|
||||
#define MS_LOG_DEBUG MSLOG_IF(mindspore::DEBUG)
|
||||
#define MS_LOG_INFO MSLOG_IF(mindspore::INFO)
|
||||
#define MS_LOG_WARNING MSLOG_IF(mindspore::WARNING)
|
||||
#define MS_LOG_ERROR MSLOG_IF(mindspore::ERROR)
|
||||
|
||||
} // namespace mindspore
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <cassert>
|
||||
#define MS_ASSERT(f) assert(f)
|
||||
#else
|
||||
#define MS_ASSERT(f) ((void)0)
|
||||
#endif
|
||||
#endif
|
||||
#endif // MINDSPORE_LITE_COMMON_LOG_ADAPTER_H_
|
|
@ -24,7 +24,7 @@
|
|||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
#include "tools/common/option.h"
|
||||
#include "include/errorcode.h"
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "src/inner_context.h"
|
||||
#include "include/errorcode.h"
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
|
||||
namespace mindspore::lite {
|
||||
int InnerContext::Init() {
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
*/
|
||||
#include "src/kernel_registry.h"
|
||||
#include "include/errorcode.h"
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/populate_parameter.h"
|
||||
#ifdef ENABLE_ARM64
|
||||
#include <asm/hwcap.h>
|
||||
#include "common/utils.h"
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
#include "nnacl/optimized_kernel.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <utility>
|
||||
#include "src/runtime/runtime_api.h"
|
||||
#include "include/errorcode.h"
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
#include "src/scheduler.h"
|
||||
#include "src/runtime/allocator.h"
|
||||
#include "src/executor.h"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
#include "src/ops/primitive_c.h"
|
||||
#include "include/model.h"
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
#include "include/errorcode.h"
|
||||
#include "src/common/graph_util.h"
|
||||
#include "include/version.h"
|
||||
|
@ -86,14 +86,14 @@ Model *Model::Import(const char *model_buf, size_t size) {
|
|||
model->buf = reinterpret_cast<char *>(malloc(size));
|
||||
if (model->buf == nullptr) {
|
||||
MS_LOG(ERROR) << "new inner model buf fail!";
|
||||
delete(model);
|
||||
delete (model);
|
||||
return nullptr;
|
||||
}
|
||||
memcpy(model->buf, model_buf, size);
|
||||
auto meta_graph = schema::GetMetaGraph(model->buf);
|
||||
if (meta_graph == nullptr) {
|
||||
MS_LOG(ERROR) << "meta_graph is nullptr!";
|
||||
delete(model);
|
||||
delete (model);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/arithmetic_self.h"
|
||||
|
||||
#ifndef LITE_MINDSPORE_LITE_C_OPS_ABS_H_
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <set>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/arithmetic.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <set>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "src/ops/arithmetic.h"
|
||||
#include "include/errorcode.h"
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
#include "src/tensor.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "src/ops/arithmetic_grad.h"
|
||||
#include "include/errorcode.h"
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
#include "src/tensor.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
@ -32,7 +31,7 @@ class ArithmeticGrad : public PrimitiveC {
|
|||
ArithmeticGrad() = default;
|
||||
explicit ArithmeticGrad(schema::PrimitiveT *primitive) : PrimitiveC(primitive) {}
|
||||
#else
|
||||
// explicit ArithmeticGrad(const schema::Primitive &primitive) : PrimitiveC(primitive) {}
|
||||
// explicit ArithmeticGrad(const schema::Primitive &primitive) : PrimitiveC(primitive) {}
|
||||
ArithmeticGrad() = default;
|
||||
int UnPackToFlatBuilder(const schema::Primitive *primitive, flatbuffers::FlatBufferBuilder *fbb) override {
|
||||
return RET_ERROR;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "src/ops/arithmetic_self.h"
|
||||
#include "include/errorcode.h"
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace lite {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "src/ops/batch_to_space.h"
|
||||
#include "src/common/common.h"
|
||||
#include "include/errorcode.h"
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
#include "src/tensor.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <set>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <set>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <set>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
@ -38,8 +37,7 @@ class BNGrad : public PrimitiveC {
|
|||
BNGrad() = default;
|
||||
int UnPackToFlatBuilder(const schema::Primitive *primitive, flatbuffers::FlatBufferBuilder *fbb) override;
|
||||
#endif
|
||||
int InferShape(std::vector<lite::Tensor *> inputs_,
|
||||
std::vector<lite::Tensor *> outputs_) override;
|
||||
int InferShape(std::vector<lite::Tensor *> inputs_, std::vector<lite::Tensor *> outputs_) override;
|
||||
float GetEps() const;
|
||||
float GetMomentum() const;
|
||||
};
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <set>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <set>
|
||||
#include <cmath>
|
||||
#include "src/ops/arithmetic_self.h"
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace lite {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "src/ops/concat.h"
|
||||
#include <memory>
|
||||
#include "include/errorcode.h"
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
#include "src/tensor.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "src/ops/constant_of_shape.h"
|
||||
#include "include/errorcode.h"
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
#include "src/tensor.h"
|
||||
|
||||
namespace mindspore::lite {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <string>
|
||||
|
||||
#include "include/errorcode.h"
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
#ifdef PRIMITIVE_WRITEABLE
|
||||
#include <float.h>
|
||||
|
||||
|
@ -120,8 +120,8 @@ void ConvertConvWeight(const ParameterPtr ¶m_node) {
|
|||
utils::cast<abstract::ShapePtr>(abstract_tensor->BuildShape())->shape()[1] = filter_k;
|
||||
utils::cast<abstract::ShapePtr>(abstract_tensor->BuildShape())->shape()[2] = filter_h;
|
||||
utils::cast<abstract::ShapePtr>(abstract_tensor->BuildShape())->shape()[3] = filter_w;
|
||||
weight->set_tensor_shape({static_cast<int>(filter_c), static_cast<int>(filter_k), static_cast<int>(filter_h),
|
||||
static_cast<int>(filter_w)});
|
||||
weight->set_tensor_shape(
|
||||
{static_cast<int>(filter_c), static_cast<int>(filter_k), static_cast<int>(filter_h), static_cast<int>(filter_w)});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include <cmath>
|
||||
#include <memory>
|
||||
#include "src/ops/primitive_c.h"
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace lite {
|
||||
|
|
|
@ -87,7 +87,7 @@ int Conv2DGradFilter::UnPackAttr(const Primitive &prim, const std::vector<AnfNod
|
|||
MS_LOG(ERROR) << "new primitiveT value failed";
|
||||
return RET_ERROR;
|
||||
}
|
||||
attr->group = GetValue<int>(prim.GetAttr("group"));
|
||||
attr->group = GetValue<int>(prim.GetAttr("group"));
|
||||
auto format = GetValue<std::string>(prim.GetAttr("data_format"));
|
||||
if (format == "NCHW") {
|
||||
attr->format = schema::Format_NCHW;
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include <cmath>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include <cmath>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/arithmetic_self.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <set>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/arithmetic.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <set>
|
||||
#include <cmath>
|
||||
#include "src/ops/primitive_c.h"
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace lite {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <set>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/arithmetic.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <set>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/arithmetic_self.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/arithmetic.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/arithmetic.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "src/ops/gather.h"
|
||||
#include "include/errorcode.h"
|
||||
#include "utils/log_adapter.h"
|
||||
#include "src/common/log_adapter.h"
|
||||
#include "src/tensor.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/arithmetic.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/arithmetic.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <set>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/arithmetic.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/arithmetic.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/arithmetic_self.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/arithmetic.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/arithmetic_self.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/arithmetic.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <set>
|
||||
#include <cmath>
|
||||
#include "src/ops/primitive_c.h"
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace lite {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/arithmetic.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <set>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/arithmetic.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/arithmetic.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/primitive_c.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include <vector>
|
||||
#include <set>
|
||||
#include <cmath>
|
||||
#include "ir/dtype/type_id.h"
|
||||
|
||||
#include "src/ops/arithmetic_self.h"
|
||||
|
||||
namespace mindspore {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue