Browse Source

change log_adapter

tags/v1.1.0
yeyunpeng 5 years ago
parent
commit
738b21c970
100 changed files with 235 additions and 396 deletions
  1. +2
    -2
      build.sh
  2. +2
    -25
      mindspore/core/utils/log_adapter.cc
  3. +1
    -2
      mindspore/core/utils/log_adapter.h
  4. +0
    -1
      mindspore/lite/CMakeLists.txt
  5. +1
    -1
      mindspore/lite/nnacl/optimized_kernel.h
  6. +49
    -46
      mindspore/lite/src/CMakeLists.txt
  7. +1
    -1
      mindspore/lite/src/common/file_utils.h
  8. +1
    -1
      mindspore/lite/src/common/file_utils_ext.h
  9. +1
    -1
      mindspore/lite/src/common/graph_util.cc
  10. +1
    -1
      mindspore/lite/src/common/graph_util.h
  11. +0
    -149
      mindspore/lite/src/common/graph_utils_extends.cc
  12. +15
    -71
      mindspore/lite/src/common/log_adapter.cc
  13. +112
    -0
      mindspore/lite/src/common/log_adapter.h
  14. +1
    -1
      mindspore/lite/src/common/utils.h
  15. +1
    -1
      mindspore/lite/src/inner_context.cc
  16. +2
    -2
      mindspore/lite/src/kernel_registry.cc
  17. +1
    -1
      mindspore/lite/src/lite_session.cc
  18. +3
    -3
      mindspore/lite/src/model.cc
  19. +1
    -1
      mindspore/lite/src/ops/abs.h
  20. +1
    -1
      mindspore/lite/src/ops/activation.h
  21. +1
    -1
      mindspore/lite/src/ops/activation_grad.h
  22. +0
    -1
      mindspore/lite/src/ops/add.h
  23. +0
    -1
      mindspore/lite/src/ops/addn.h
  24. +1
    -1
      mindspore/lite/src/ops/apply_momentum.h
  25. +1
    -1
      mindspore/lite/src/ops/argmax.h
  26. +0
    -1
      mindspore/lite/src/ops/argmin.h
  27. +1
    -1
      mindspore/lite/src/ops/arithmetic.cc
  28. +0
    -1
      mindspore/lite/src/ops/arithmetic.h
  29. +1
    -1
      mindspore/lite/src/ops/arithmetic_grad.cc
  30. +1
    -2
      mindspore/lite/src/ops/arithmetic_grad.h
  31. +1
    -1
      mindspore/lite/src/ops/arithmetic_self.cc
  32. +0
    -1
      mindspore/lite/src/ops/batch_norm.h
  33. +1
    -1
      mindspore/lite/src/ops/batch_to_space.cc
  34. +0
    -1
      mindspore/lite/src/ops/batch_to_space.h
  35. +0
    -1
      mindspore/lite/src/ops/bias_add.h
  36. +0
    -1
      mindspore/lite/src/ops/bias_grad.h
  37. +1
    -3
      mindspore/lite/src/ops/bn_grad.h
  38. +0
    -1
      mindspore/lite/src/ops/broadcast_to.h
  39. +0
    -1
      mindspore/lite/src/ops/cast.h
  40. +0
    -1
      mindspore/lite/src/ops/ceil.h
  41. +0
    -1
      mindspore/lite/src/ops/clip.h
  42. +1
    -1
      mindspore/lite/src/ops/concat.cc
  43. +0
    -1
      mindspore/lite/src/ops/concat.h
  44. +1
    -1
      mindspore/lite/src/ops/constant_of_shape.cc
  45. +0
    -1
      mindspore/lite/src/ops/constant_of_shape.h
  46. +3
    -3
      mindspore/lite/src/ops/conv2d.cc
  47. +0
    -1
      mindspore/lite/src/ops/conv2d.h
  48. +1
    -1
      mindspore/lite/src/ops/conv2d_grad_filter.cc
  49. +0
    -1
      mindspore/lite/src/ops/conv2d_grad_filter.h
  50. +0
    -1
      mindspore/lite/src/ops/conv2d_grad_input.h
  51. +0
    -1
      mindspore/lite/src/ops/cos.h
  52. +0
    -1
      mindspore/lite/src/ops/crop.h
  53. +0
    -1
      mindspore/lite/src/ops/deconv2d.h
  54. +0
    -1
      mindspore/lite/src/ops/dedepthwise_conv2d.h
  55. +0
    -1
      mindspore/lite/src/ops/depth_to_space.h
  56. +0
    -1
      mindspore/lite/src/ops/depthwise_conv2d.h
  57. +0
    -1
      mindspore/lite/src/ops/detection_post_process.h
  58. +0
    -1
      mindspore/lite/src/ops/div.h
  59. +0
    -1
      mindspore/lite/src/ops/dropout.h
  60. +0
    -1
      mindspore/lite/src/ops/eltwise.h
  61. +0
    -1
      mindspore/lite/src/ops/elu.h
  62. +0
    -1
      mindspore/lite/src/ops/embedding_lookup.h
  63. +0
    -1
      mindspore/lite/src/ops/embedding_lookup_sparse.h
  64. +0
    -1
      mindspore/lite/src/ops/equal.h
  65. +0
    -1
      mindspore/lite/src/ops/exp.h
  66. +0
    -1
      mindspore/lite/src/ops/expand_dims.h
  67. +0
    -1
      mindspore/lite/src/ops/fake_quant_with_min_max_vars.h
  68. +0
    -1
      mindspore/lite/src/ops/fill.h
  69. +0
    -1
      mindspore/lite/src/ops/flatten.h
  70. +0
    -1
      mindspore/lite/src/ops/flatten_grad.h
  71. +0
    -1
      mindspore/lite/src/ops/floor.h
  72. +0
    -1
      mindspore/lite/src/ops/floor_div.h
  73. +0
    -1
      mindspore/lite/src/ops/floor_mod.h
  74. +0
    -1
      mindspore/lite/src/ops/full_connection.h
  75. +0
    -1
      mindspore/lite/src/ops/fused_batchnorm.h
  76. +1
    -1
      mindspore/lite/src/ops/gather.cc
  77. +1
    -1
      mindspore/lite/src/ops/gather.h
  78. +1
    -1
      mindspore/lite/src/ops/gather_nd.h
  79. +1
    -1
      mindspore/lite/src/ops/greater.h
  80. +1
    -1
      mindspore/lite/src/ops/greater_equal.h
  81. +1
    -1
      mindspore/lite/src/ops/l2_norm.h
  82. +1
    -1
      mindspore/lite/src/ops/leaky_relu.h
  83. +1
    -1
      mindspore/lite/src/ops/less.h
  84. +1
    -1
      mindspore/lite/src/ops/less_equal.h
  85. +1
    -1
      mindspore/lite/src/ops/local_response_normalization.h
  86. +1
    -1
      mindspore/lite/src/ops/log.h
  87. +1
    -1
      mindspore/lite/src/ops/log_grad.h
  88. +1
    -1
      mindspore/lite/src/ops/logical_and.h
  89. +1
    -1
      mindspore/lite/src/ops/logical_not.h
  90. +1
    -1
      mindspore/lite/src/ops/logical_or.h
  91. +1
    -1
      mindspore/lite/src/ops/lrn.h
  92. +1
    -1
      mindspore/lite/src/ops/lstm.h
  93. +0
    -1
      mindspore/lite/src/ops/matmul.h
  94. +1
    -1
      mindspore/lite/src/ops/matrix_diag.h
  95. +1
    -1
      mindspore/lite/src/ops/maximum.h
  96. +1
    -1
      mindspore/lite/src/ops/mean.h
  97. +1
    -1
      mindspore/lite/src/ops/minimum.h
  98. +1
    -1
      mindspore/lite/src/ops/mul.h
  99. +1
    -1
      mindspore/lite/src/ops/nchw2nhwc.h
  100. +1
    -1
      mindspore/lite/src/ops/neg.h

+ 2
- 2
build.sh View File

@@ -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} \


+ 2
- 25
mindspore/core/utils/log_adapter.cc View File

@@ -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 {


+ 1
- 2
mindspore/core/utils/log_adapter.h View File

@@ -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
};



+ 0
- 1
mindspore/lite/CMakeLists.txt View File

@@ -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}")


+ 1
- 1
mindspore/lite/nnacl/optimized_kernel.h View File

@@ -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"


+ 49
- 46
mindspore/lite/src/CMakeLists.txt View File

@@ -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 ()


+ 1
- 1
mindspore/lite/src/common/file_utils.h View File

@@ -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 {


+ 1
- 1
mindspore/lite/src/common/file_utils_ext.h View File

@@ -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_

+ 1
- 1
mindspore/lite/src/common/graph_util.cc View File

@@ -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 {


+ 1
- 1
mindspore/lite/src/common/graph_util.h View File

@@ -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"



+ 0
- 149
mindspore/lite/src/common/graph_utils_extends.cc View File

@@ -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 &param) {
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

+ 15
- 71
mindspore/lite/src/common/log_adapter.cc View File

@@ -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

+ 112
- 0
mindspore/lite/src/common/log_adapter.h View File

@@ -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_

+ 1
- 1
mindspore/lite/src/common/utils.h View File

@@ -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"



+ 1
- 1
mindspore/lite/src/inner_context.cc View File

@@ -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() {


+ 2
- 2
mindspore/lite/src/kernel_registry.cc View File

@@ -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



+ 1
- 1
mindspore/lite/src/lite_session.cc View File

@@ -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"


+ 3
- 3
mindspore/lite/src/model.cc View File

@@ -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;
}



+ 1
- 1
mindspore/lite/src/ops/abs.h View File

@@ -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_


+ 1
- 1
mindspore/lite/src/ops/activation.h View File

@@ -19,7 +19,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/activation_grad.h View File

@@ -21,7 +21,7 @@
#include <set>
#include <cmath>
#include <memory>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/add.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/addn.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/apply_momentum.h View File

@@ -21,7 +21,7 @@
#include <set>
#include <cmath>
#include <memory>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/argmax.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/argmin.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/arithmetic.cc View File

@@ -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 {


+ 0
- 1
mindspore/lite/src/ops/arithmetic.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/arithmetic_grad.cc View File

@@ -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 {


+ 1
- 2
mindspore/lite/src/ops/arithmetic_grad.h View File

@@ -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;


+ 1
- 1
mindspore/lite/src/ops/arithmetic_self.cc View File

@@ -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 {


+ 0
- 1
mindspore/lite/src/ops/batch_norm.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/batch_to_space.cc View File

@@ -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 {


+ 0
- 1
mindspore/lite/src/ops/batch_to_space.h View File

@@ -21,7 +21,6 @@
#include <set>
#include <cmath>
#include <memory>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/bias_add.h View File

@@ -21,7 +21,6 @@
#include <set>
#include <cmath>
#include <memory>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/bias_grad.h View File

@@ -21,7 +21,6 @@
#include <set>
#include <cmath>
#include <memory>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 3
mindspore/lite/src/ops/bn_grad.h View File

@@ -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;
};


+ 0
- 1
mindspore/lite/src/ops/broadcast_to.h View File

@@ -21,7 +21,6 @@
#include <set>
#include <cmath>
#include <memory>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/cast.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/ceil.h View File

@@ -21,7 +21,6 @@
#include <set>
#include <cmath>
#include "src/ops/arithmetic_self.h"
#include "ir/dtype/type_id.h"

namespace mindspore {
namespace lite {


+ 0
- 1
mindspore/lite/src/ops/clip.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/concat.cc View File

@@ -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 {


+ 0
- 1
mindspore/lite/src/ops/concat.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/constant_of_shape.cc View File

@@ -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 {


+ 0
- 1
mindspore/lite/src/ops/constant_of_shape.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 3
- 3
mindspore/lite/src/ops/conv2d.cc View File

@@ -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 &param_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;
}


+ 0
- 1
mindspore/lite/src/ops/conv2d.h View File

@@ -22,7 +22,6 @@
#include <cmath>
#include <memory>
#include "src/ops/primitive_c.h"
#include "ir/dtype/type_id.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/src/ops/conv2d_grad_filter.cc View File

@@ -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;


+ 0
- 1
mindspore/lite/src/ops/conv2d_grad_filter.h View File

@@ -22,7 +22,6 @@
#include <cmath>
#include <memory>
#include <string>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/conv2d_grad_input.h View File

@@ -22,7 +22,6 @@
#include <cmath>
#include <memory>
#include <string>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/cos.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic_self.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/crop.h View File

@@ -21,7 +21,6 @@
#include <set>
#include <cmath>
#include <memory>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/deconv2d.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/dedepthwise_conv2d.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/depth_to_space.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/depthwise_conv2d.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/detection_post_process.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/div.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/dropout.h View File

@@ -21,7 +21,6 @@
#include <set>
#include <cmath>
#include "src/ops/primitive_c.h"
#include "ir/dtype/type_id.h"

namespace mindspore {
namespace lite {


+ 0
- 1
mindspore/lite/src/ops/eltwise.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/elu.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/embedding_lookup.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/embedding_lookup_sparse.h View File

@@ -21,7 +21,6 @@
#include <set>
#include <cmath>
#include <memory>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/equal.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/exp.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/expand_dims.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/fake_quant_with_min_max_vars.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/fill.h View File

@@ -21,7 +21,6 @@
#include <set>
#include <cmath>
#include <memory>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/flatten.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/flatten_grad.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/floor.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic_self.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/floor_div.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/floor_mod.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/full_connection.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/fused_batchnorm.h View File

@@ -20,7 +20,6 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/gather.cc View File

@@ -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 {


+ 1
- 1
mindspore/lite/src/ops/gather.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/gather_nd.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/greater.h View File

@@ -19,7 +19,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/greater_equal.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/l2_norm.h View File

@@ -21,7 +21,7 @@
#include <set>
#include <cmath>
#include <memory>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/leaky_relu.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/less.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/less_equal.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/local_response_normalization.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/log.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic_self.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/log_grad.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/logical_and.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/logical_not.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic_self.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/logical_or.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/lrn.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/lstm.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 0
- 1
mindspore/lite/src/ops/matmul.h View File

@@ -21,7 +21,6 @@
#include <set>
#include <cmath>
#include "src/ops/primitive_c.h"
#include "ir/dtype/type_id.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/src/ops/matrix_diag.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/maximum.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/mean.h View File

@@ -21,7 +21,7 @@
#include <set>
#include <cmath>
#include <memory>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/minimum.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/mul.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/arithmetic.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/nchw2nhwc.h View File

@@ -20,7 +20,7 @@
#include <vector>
#include <set>
#include <cmath>
#include "ir/dtype/type_id.h"
#include "src/ops/primitive_c.h"

namespace mindspore {


+ 1
- 1
mindspore/lite/src/ops/neg.h View File

@@ -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 changed in this diff

Loading…
Cancel
Save