From a0ef03cc0e72f38d151df4984145d374285ba4ba Mon Sep 17 00:00:00 2001 From: xuanyue Date: Sun, 23 Aug 2020 14:00:13 +0800 Subject: [PATCH] fix bug --- build.sh | 2 ++ mindspore/lite/include/version.h | 9 +++++++++ mindspore/lite/src/ops/unsqueeze.cc | 2 +- .../runtime/kernel/arm/fp32/convolution_depthwise.cc | 2 +- mindspore/lite/tools/anf_exporter/anf_exporter.cc | 10 ++++++++-- .../lite/tools/converter/parser/caffe/CMakeLists.txt | 3 ++- .../tools/converter/parser/caffe/caffe_tanh_parser.cc | 2 +- .../tools/converter/parser/onnx/onnx_slice_parser.cc | 2 +- 8 files changed, 25 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index 9e032688358..e0e13cda77c 100755 --- a/build.sh +++ b/build.sh @@ -618,10 +618,12 @@ build_lite() if [[ "${COMPILE_RET}" -ne 0 ]]; then echo "---------------- mindspore lite: build failed ----------------" + exit 1 else mv ${BASEPATH}/output/tmp/*.tar.gz* ${BASEPATH}/output/ rm -rf ${BASEPATH}/output/tmp/ echo "---------------- mindspore lite: build success ----------------" + exit 0 fi } diff --git a/mindspore/lite/include/version.h b/mindspore/lite/include/version.h index c2534e55d1c..a6f77eb10d5 100644 --- a/mindspore/lite/include/version.h +++ b/mindspore/lite/include/version.h @@ -24,6 +24,15 @@ namespace lite { /// \brief Global method to get a version string. /// /// \return The version string of MindSpore Lite. +#ifndef MS_VERSION_MAJOY +#define MS_VERSION_MAJOY 0 +#endif +#ifndef MS_VERSION_MINOR +#define MS_VERSION_MINOR 7 +#endif +#ifndef MS_VERSION_REVISION +#define MS_VERSION_REVISION 0 +#endif std::string Version() { return "MindSpore Lite " + std::to_string(MS_VERSION_MAJOY) + "." + std::to_string(MS_VERSION_MINOR) + "." + std::to_string(MS_VERSION_REVISION); diff --git a/mindspore/lite/src/ops/unsqueeze.cc b/mindspore/lite/src/ops/unsqueeze.cc index f515bc9567e..3234852d217 100644 --- a/mindspore/lite/src/ops/unsqueeze.cc +++ b/mindspore/lite/src/ops/unsqueeze.cc @@ -54,7 +54,7 @@ int Unsqueeze::InferShape(std::vector inputs_, std::vectorshape(); auto in_rank = in_shape.size(); auto dim_rank = GetAxis().size(); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise.cc index df59dbf3839..067c09a46e9 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/convolution_depthwise.cc @@ -30,7 +30,7 @@ using mindspore::schema::PrimitiveType_DepthwiseConv2D; namespace mindspore::kernel { ConvolutionDepthwiseCPUKernel::~ConvolutionDepthwiseCPUKernel() { if (packed_weight_ != nullptr) { - delete packed_weight_; + free(packed_weight_); packed_weight_ = nullptr; } } diff --git a/mindspore/lite/tools/anf_exporter/anf_exporter.cc b/mindspore/lite/tools/anf_exporter/anf_exporter.cc index 6a7402688c3..07e802d89be 100644 --- a/mindspore/lite/tools/anf_exporter/anf_exporter.cc +++ b/mindspore/lite/tools/anf_exporter/anf_exporter.cc @@ -142,7 +142,10 @@ void AnfExporter::SetGraphoutputIndex(const CNodePtr &cnode, const std::unique_p MS_ASSERT(nullptr != return_node); for (size_t i = 1; i < cnode->inputs().size(); i++) { auto input_node = cnode->input(i); - if (input_node->isa()) { + if (input_node == nullptr) { + MS_LOG(ERROR) << "output node is nullptr"; + return; + } else if (input_node->isa()) { auto ret = ConvertInputCNode(input_node, return_node); if (ret != RET_OK) { MS_LOG(ERROR) << "obtain outputs failed"; @@ -175,7 +178,10 @@ schema::MetaGraphT *AnfExporter::Export(const FuncGraphPtr &func_graph) { RemoveIfMakeTuple(cnode); auto node = std::make_unique(); - + if (node == nullptr) { + MS_LOG(ERROR) << "object failed to be constructed"; + return nullptr; + } if (primT->value.type == schema::PrimitiveType_Return) { node->name = "return_node"; SetGraphoutputIndex(cnode, meta_graphT, node.get()); diff --git a/mindspore/lite/tools/converter/parser/caffe/CMakeLists.txt b/mindspore/lite/tools/converter/parser/caffe/CMakeLists.txt index a0b8ee236ed..f468c1e2c58 100644 --- a/mindspore/lite/tools/converter/parser/caffe/CMakeLists.txt +++ b/mindspore/lite/tools/converter/parser/caffe/CMakeLists.txt @@ -28,4 +28,5 @@ add_library(caffe_parser_mid OBJECT ${CMAKE_CURRENT_SOURCE_DIR}/caffe_inspector.cc ${CMAKE_CURRENT_SOURCE_DIR}/caffe_interp_parser.cc ${CMAKE_CURRENT_SOURCE_DIR}/caffe_permute_parser.cc - ${CMAKE_CURRENT_SOURCE_DIR}/caffe_tile_parser.cc) + ${CMAKE_CURRENT_SOURCE_DIR}/caffe_tile_parser.cc + ${CMAKE_CURRENT_SOURCE_DIR}/caffe_tanh_parser.cc) diff --git a/mindspore/lite/tools/converter/parser/caffe/caffe_tanh_parser.cc b/mindspore/lite/tools/converter/parser/caffe/caffe_tanh_parser.cc index 20aff695fdb..fef40348924 100644 --- a/mindspore/lite/tools/converter/parser/caffe/caffe_tanh_parser.cc +++ b/mindspore/lite/tools/converter/parser/caffe/caffe_tanh_parser.cc @@ -32,7 +32,7 @@ STATUS CaffeTanhParser::Parse(const caffe::LayerParameter &proto, return RET_OK; } -CaffeNodeRegistrar g_caffeTanhParser("Tanh", new CaffeTanhParser()); +CaffeNodeRegistrar g_caffeTanhParser("TanH", new CaffeTanhParser()); } // namespace lite } // namespace mindspore diff --git a/mindspore/lite/tools/converter/parser/onnx/onnx_slice_parser.cc b/mindspore/lite/tools/converter/parser/onnx/onnx_slice_parser.cc index c2bda2c3d86..91f7fd2e4ae 100644 --- a/mindspore/lite/tools/converter/parser/onnx/onnx_slice_parser.cc +++ b/mindspore/lite/tools/converter/parser/onnx/onnx_slice_parser.cc @@ -42,7 +42,7 @@ STATUS OnnxSliceParser::Parse(const onnx::GraphProto &onnx_graph, const onnx::No const auto &attribute_name = onnx_node_attr.name(); if (attribute_name == "starts") { const int size = onnx_node_attr.ints_size(); - MS_LOG(ERROR) << "SLICE starts size " << size; + MS_LOG(INFO) << "SLICE starts size " << size; for (int i = 0; i < size; ++i) { attr->begin.emplace_back(static_cast(onnx_node_attr.ints(i))); }