diff --git a/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/extract_image_patches_gpu_kernel.h b/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/extract_image_patches_gpu_kernel.h index 2c61ed73f91..0b0ae56f0dc 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/extract_image_patches_gpu_kernel.h +++ b/mindspore/ccsrc/backend/kernel_compiler/gpu/arrays/extract_image_patches_gpu_kernel.h @@ -49,7 +49,7 @@ class ExtractImagePatchesKernel : public GpuKernel { size_t *t_output_shape = GetDeviceAddress(workspace, 4); size_t *t_output_to_nchw_axis = GetDeviceAddress(workspace, 5); - size_t shape_size = 4 * sizeof(size_t); + const size_t shape_size = 4 * sizeof(size_t); std::vector to_nhwc_axis = {0, 2, 3, 1}; std::vector to_nchw_axis = {0, 3, 1, 2}; diff --git a/mindspore/ccsrc/backend/kernel_compiler/gpu/nn/local_response_norm_gpu_kernel.h b/mindspore/ccsrc/backend/kernel_compiler/gpu/nn/local_response_norm_gpu_kernel.h index 5b8200e5fb1..5f949be0775 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/gpu/nn/local_response_norm_gpu_kernel.h +++ b/mindspore/ccsrc/backend/kernel_compiler/gpu/nn/local_response_norm_gpu_kernel.h @@ -51,7 +51,7 @@ class LocalResponseNormGpuKernel : public GpuKernel { if (use_native_) { std::vector to_nhwc_axis = {0, 2, 3, 1}; std::vector to_nchw_axis = {0, 3, 1, 2}; - size_t shape_size = 4 * sizeof(size_t); + const size_t shape_size = 4 * sizeof(size_t); size_t *ws_input_shape = GetDeviceAddress(workspace, 0); size_t *ws_transpose_shape = GetDeviceAddress(workspace, 1); size_t *ws_to_nhwc_axis = GetDeviceAddress(workspace, 2); @@ -107,7 +107,7 @@ class LocalResponseNormGpuKernel : public GpuKernel { beta_ = GetAttr(kernel_node, "beta"); use_native_ = false; - unsigned int lrnN = 2 * depth_radius_ + 1; + const unsigned int lrnN = 2 * depth_radius_ + 1; double lrnAlpha = lrnN * alpha_; if (lrnN < CUDNN_LRN_MIN_N || lrnN > CUDNN_LRN_MAX_N || bias_ < CUDNN_LRN_MIN_K || beta_ < CUDNN_LRN_MIN_BETA) { use_native_ = true; @@ -191,7 +191,7 @@ class LocalResponseNormGpuKernel : public GpuKernel { if (use_native_) { input_size_ = num_elements_ * sizeof(T); output_size_ = num_elements_ * sizeof(T); - size_t shape_size = 4 * sizeof(size_t); + const size_t shape_size = 4 * sizeof(size_t); workspace_size_list_.push_back(shape_size); workspace_size_list_.push_back(shape_size); workspace_size_list_.push_back(shape_size); diff --git a/mindspore/ccsrc/backend/kernel_compiler/gpu/nn/local_response_norm_grad_gpu_kernel.h b/mindspore/ccsrc/backend/kernel_compiler/gpu/nn/local_response_norm_grad_gpu_kernel.h index 86616624717..d91d2a0eacd 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/gpu/nn/local_response_norm_grad_gpu_kernel.h +++ b/mindspore/ccsrc/backend/kernel_compiler/gpu/nn/local_response_norm_grad_gpu_kernel.h @@ -55,7 +55,7 @@ class LocalResponseNormGradGpuKernel : public GpuKernel { MS_LOG(WARNING) << "TOM: num_elements_ " << num_elements_; std::vector to_nhwc_axis = {0, 2, 3, 1}; std::vector to_nchw_axis = {0, 3, 1, 2}; - size_t shape_size = 4 * sizeof(size_t); + const size_t shape_size = 4 * sizeof(size_t); size_t *ws_input_shape = GetDeviceAddress(workspace, 0); size_t *ws_transpose_shape = GetDeviceAddress(workspace, 1); size_t *ws_to_nhwc_axis = GetDeviceAddress(workspace, 2); @@ -117,7 +117,7 @@ class LocalResponseNormGradGpuKernel : public GpuKernel { beta_ = GetAttr(kernel_node, "beta"); use_native_ = false; - unsigned int lrnN = 2 * depth_radius_ + 1; + const unsigned int lrnN = 2 * depth_radius_ + 1; double lrnAlpha = lrnN * alpha_; if (lrnN < CUDNN_LRN_MIN_N || lrnN > CUDNN_LRN_MAX_N || bias_ < CUDNN_LRN_MIN_K || beta_ < CUDNN_LRN_MIN_BETA) { use_native_ = true; @@ -207,7 +207,7 @@ class LocalResponseNormGradGpuKernel : public GpuKernel { if (use_native_) { input_size_ = num_elements_ * sizeof(T); output_size_ = num_elements_ * sizeof(T); - size_t shape_size = 4 * sizeof(size_t); + const size_t shape_size = 4 * sizeof(size_t); workspace_size_list_.push_back(shape_size); workspace_size_list_.push_back(shape_size); workspace_size_list_.push_back(shape_size);