From 925583ac828b278609257e428f3d0984c8a7e49a Mon Sep 17 00:00:00 2001 From: zhaozhenlong Date: Thu, 16 Sep 2021 10:26:53 +0800 Subject: [PATCH] code check --- .../runtime/kernel/arm/fp16/convolution_depthwise_3x3_fp16.cc | 1 - .../lite/src/runtime/kernel/arm/fp32/sparse_to_dense_fp32.cc | 2 +- .../lite/src/runtime/kernel/opencl/kernel/sparse_to_dense.cc | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_depthwise_3x3_fp16.cc b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_depthwise_3x3_fp16.cc index d85b5ff3b51..8cd8f62b7c9 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_depthwise_3x3_fp16.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp16/convolution_depthwise_3x3_fp16.cc @@ -147,6 +147,5 @@ int ConvolutionDepthwise3x3Fp16CPUKernel::Run() { } return RET_OK; } - } // namespace mindspore::kernel #endif diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/sparse_to_dense_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/sparse_to_dense_fp32.cc index a0b96f00ec6..174418d5142 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/sparse_to_dense_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/sparse_to_dense_fp32.cc @@ -33,7 +33,7 @@ int SparseToDenseCPUKernel::Init() { MS_CHECK_TRUE_RET(in_tensors_.size() == kInputSize2, RET_ERROR); CHECK_NULL_RETURN(in_tensors_[0]); CHECK_NULL_RETURN(in_tensors_[1]); - CHECK_NULL_RETURN(in_tensors_[2]); + CHECK_NULL_RETURN(in_tensors_[DIMENSION_2D]); MS_CHECK_TRUE_RET(out_tensors_.size() == 1, RET_ERROR); CHECK_NULL_RETURN(out_tensors_.front()); auto input2 = in_tensors_.at(2); diff --git a/mindspore/lite/src/runtime/kernel/opencl/kernel/sparse_to_dense.cc b/mindspore/lite/src/runtime/kernel/opencl/kernel/sparse_to_dense.cc index 385ad6b58cd..5922f71611c 100644 --- a/mindspore/lite/src/runtime/kernel/opencl/kernel/sparse_to_dense.cc +++ b/mindspore/lite/src/runtime/kernel/opencl/kernel/sparse_to_dense.cc @@ -55,7 +55,7 @@ int SparseToDenseOpenCLKernel::InitOutputToDefault() { int SparseToDenseOpenCLKernel::InitWeights() { auto allocator = ocl_runtime_->GetAllocator(); - MS_CHECK_GE(in_tensors_.size(), 3, RET_ERROR); + MS_CHECK_GE(in_tensors_.size(), DIMENSION_3D, RET_ERROR); auto weight_tensor = in_tensors_[2]; size_t size = 1; for (int i = 0; i < weight_tensor->shape().size(); ++i) { @@ -176,7 +176,7 @@ void SparseToDenseOpenCLKernel::SetGlobalLocal() { int SparseToDenseOpenCLKernel::Prepare() { enable_fp16_ = ocl_runtime_->GetFp16Enable(); input_dim_ = in_tensors_[0]->shape().size(); - MS_CHECK_GE(input_dim_, 2, RET_ERROR); + MS_CHECK_GE(input_dim_, DIMENSION_2D, RET_ERROR); inshapeindex1_dim = in_tensors_[0]->shape()[1]; weight_scalar_ = in_tensors_[2]->IsScalar(); const std::string kernel_name = "SparseToDense" + std::string(weight_scalar_ ? "Scalar" : "Vector");