diff --git a/mindspore/lite/src/executor.cc b/mindspore/lite/src/executor.cc index 27289dfa0b8be969b4954849cbd6a1a364f22404..c464eb8fb09c769ef836913bd8b15555b5894c68 100644 --- a/mindspore/lite/src/executor.cc +++ b/mindspore/lite/src/executor.cc @@ -82,6 +82,8 @@ int Executor::TransformTensorLayout(tensor::Tensor *tensor, schema::Format dst_f return TransformTensorLayoutUint8(tensor, dst_format, allocator); case kNumberTypeFloat32: return TransformTensorLayoutFp32(tensor, dst_format, allocator); + default: + return RET_ERROR; } return RET_OK; } diff --git a/mindspore/lite/src/ops/scatter_nd.cc b/mindspore/lite/src/ops/scatter_nd.cc index 446a37d8720e3316bdd53a9284096ef2881fd6f3..5384edbf916a512ca1fa8ed3660735acd537fc7c 100644 --- a/mindspore/lite/src/ops/scatter_nd.cc +++ b/mindspore/lite/src/ops/scatter_nd.cc @@ -54,7 +54,7 @@ int ScatterND::InferShape(std::vector inputs_, std::vector(shape->Data()); - std::vector out_shape(shape_data, shape_data + sizeof(shape_data) / sizeof(shape_data[0])); + std::vector out_shape(shape_data, shape_data + shape->DataSize()); output->set_shape(out_shape); output->set_data_type(update->data_type()); output->SetFormat(update->GetFormat()); diff --git a/mindspore/lite/src/ops/shape.cc b/mindspore/lite/src/ops/shape.cc index 8ca3416d78b5a78e4ab28272b183e273472dbd86..6c4c239354d590904d2fef96ed530f0e29015388 100644 --- a/mindspore/lite/src/ops/shape.cc +++ b/mindspore/lite/src/ops/shape.cc @@ -45,7 +45,7 @@ int Shape::InferShape(std::vector inputs_, std::vectorset_data_type({in_tensor->data_type()}); + auto ret_dtype = out_tensor->set_data_type(in_tensor->data_type()); if (ret_dtype != in_tensor->data_type()) { MS_LOG(ERROR) << "Set datatype fails."; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/opt_momentum.h b/mindspore/lite/src/runtime/kernel/arm/fp32/opt_momentum.h index 6746b5bf0b1c4d62c3406e0845ab87648034c293..ccc28717795569e187bfd40a1d8d0799108bb7f8 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/opt_momentum.h +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/opt_momentum.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef MINDSPORE_LITE_SRC_BACKEND_ARM_FP32_OPT_MOMENTUM_H_ -#define MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_OPT_MOMENTUM_H_ +#ifndef MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_FP32_OPT_MOMENTUM_H_ +#define MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_FP32_OPT_MOMENTUM_H_ #include #include "src/lite_kernel.h" @@ -37,4 +37,4 @@ class OptMomentumCPUKernel : public LiteKernel { }; } // namespace mindspore::kernel -#endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_OPT_MOMENTUM_H_ +#endif // MINDSPORE_LITE_SRC_RUNTIME_KERNEL_ARM_FP32_OPT_MOMENTUM_H_ diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/space_to_depth.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/space_to_depth.cc index 3ecb34a6a6030d391471eb2a861813928fa84570..fe253cda56b133de48593dd16c2068a13462c09b 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/space_to_depth.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/space_to_depth.cc @@ -85,6 +85,7 @@ int SpaceToDepthCPUKernel::Run() { MS_LOG(ERROR) << "SpaceToDepth error error_code[" << ret << "]"; return ret; } + return RET_OK; } else { MS_LOG(ERROR) << "Only support NHWC now!"; return RET_ERROR; diff --git a/mindspore/lite/src/runtime/kernel/arm/opclib/quantization/quantize.h b/mindspore/lite/src/runtime/kernel/arm/opclib/quantization/quantize.h index a0d78631f12965852a8f4393f3b5ea871648c60b..61a8a5380e4718e31aa111a35b94fa633563873e 100644 --- a/mindspore/lite/src/runtime/kernel/arm/opclib/quantization/quantize.h +++ b/mindspore/lite/src/runtime/kernel/arm/opclib/quantization/quantize.h @@ -143,7 +143,7 @@ inline void CalculateActivationRangeQuantized(bool is_relu, bool is_relu6, int32 inline void Quantize(float *input_data, int length, float scale, int zero_point, int8_t *output_data) { for (int i = 0; i < length; ++i) { int r = (int)round(input_data[i] / scale + zero_point); - int8_t q = r > CHAR_MAX ? CHAR_MAX : r; + int8_t q = r > CHAR_MAX ? (int8_t)CHAR_MAX : (int8_t)r; q = q < CHAR_MIN ? CHAR_MIN : q; output_data[i] = q; } diff --git a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/space_to_batch_fp32_tests.cc b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/space_to_batch_fp32_tests.cc index 7445f0a75e01a9849629ef5b30b1ec9267876dc0..3088ca9a6eef108035f96db3d0b839a22525c2e3 100644 --- a/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/space_to_batch_fp32_tests.cc +++ b/mindspore/lite/test/ut/src/runtime/kernel/arm/fp32/space_to_batch_fp32_tests.cc @@ -28,7 +28,7 @@ class SpaceToBatchTestFp32 : public mindspore::Common { SpaceToBatchTestFp32() {} }; -int InitSpaceToBatchParameter(SpaceToBatchParameter *param) { +void InitSpaceToBatchParameter(SpaceToBatchParameter *param) { param->n_dims_ = 4; param->n_space_dims_ = 2; @@ -56,7 +56,7 @@ int InitSpaceToBatchParameter(SpaceToBatchParameter *param) { param->need_paddings_ = true; } -int InitSpaceToBatchParameter2(SpaceToBatchParameter *param) { +void InitSpaceToBatchParameter2(SpaceToBatchParameter *param) { param->block_sizes_[0] = 2; param->block_sizes_[1] = 2;