diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/base/split_base.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/base/split_base.c index f822b94155b..5150da35c7f 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/base/split_base.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/base/split_base.c @@ -23,10 +23,10 @@ int DoSplit(void *in_data, void **out_data, const int *input_shape, int offset, const SplitParameter *split_param, int data_size) { int8_t *int8_in = (int8_t *)in_data; - int num_split = split_param->num_split_; - int *split_sizes = split_param->split_sizes_; + const int num_split = split_param->num_split_; + const int *split_sizes = split_param->split_sizes_; const int *strides = split_param->strides_; - int split_dim = split_param->split_dim_; + const int split_dim = split_param->split_dim_; int in_stride = strides[split_dim]; int in_stride_bytes = in_stride * data_size; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/base/split_with_over_lap_base.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/base/split_with_over_lap_base.c index f93b42dc193..77d3844be9c 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/base/split_with_over_lap_base.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/base/split_with_over_lap_base.c @@ -18,15 +18,16 @@ #include #include "nnacl/errorcode.h" -int DoSplitWithOverlapParallel(char *in_data, char **out_data, int slice_idx, const SplitWithOverlapParameter *param, - const int *start_indices, const int *end_indices) { +int DoSplitWithOverlapParallel(const char *in_data, char **out_data, int slice_idx, + const SplitWithOverlapParameter *param, const int *start_indices, + const int *end_indices) { int start_index = start_indices[slice_idx]; int end_index = end_indices[slice_idx]; int input_stride = param->split_dim_size_ * param->inner_stride_ * param->element_bytes_; int out_stride = (end_index - start_index) * param->inner_stride_ * param->element_bytes_; - char *src_ptr = in_data + start_index * param->inner_stride_ * param->element_bytes_; + const char *src_ptr = in_data + start_index * param->inner_stride_ * param->element_bytes_; char *dst_ptr = out_data[slice_idx]; for (int i = 0; i < param->outer_total_dim_; i++) { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/base/split_with_over_lap_base.h b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/base/split_with_over_lap_base.h index fe236160ae4..a349f9941e6 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/base/split_with_over_lap_base.h +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/base/split_with_over_lap_base.h @@ -23,8 +23,9 @@ #ifdef __cplusplus extern "C" { #endif -int DoSplitWithOverlapParallel(char *in_data, char **out_data, int slice_idx, const SplitWithOverlapParameter *param, - const int *start_indices, const int *end_indices); +int DoSplitWithOverlapParallel(const char *in_data, char **out_data, int slice_idx, + const SplitWithOverlapParameter *param, const int *start_indices, + const int *end_indices); #ifdef __cplusplus } #endif diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/fp32/strided_slice_fp32.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/fp32/strided_slice_fp32.c index 1e63955173c..c2f76bb3fef 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/fp32/strided_slice_fp32.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/fp32/strided_slice_fp32.c @@ -115,12 +115,12 @@ int DoStridedSliceIntFp64Bool(const void *in_data, void *out_data, StridedSliceP } int DoStridedSlice(const void *in_data, void *out_data, StridedSliceParameter *param) { - if (param->data_type != kDataTypeFloat && param->data_type != kDataTypeFloat16) { - return DoStridedSliceIntFp64Bool(in_data, out_data, param); - } if (in_data == NULL || out_data == NULL || param == NULL) { return NNACL_NULL_PTR; } + if (param->data_type != kDataTypeFloat && param->data_type != kDataTypeFloat16) { + return DoStridedSliceIntFp64Bool(in_data, out_data, param); + } if (param->num_axes_ > DIMENSION_8D) { return NNACL_PARAM_INVALID; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/arg_min_max_int8.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/arg_min_max_int8.c index 6314b6b0d6f..2b6200e187a 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/arg_min_max_int8.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/arg_min_max_int8.c @@ -90,7 +90,7 @@ int8_t GetInt8Output(float real_out, float output_inverse_scale, int32_t output_ } void Int8ArgMinMaxDim0(const int8_t *input, int8_t *output, const int *in_shape, ArgMinMaxParameter *param, - QuantArg *in_quant_arg, QuantArg *out_quant_arg) { + QuantArg *in_quant_arg, const QuantArg *out_quant_arg) { bool out_value = param->out_value_; const float output_inverse_scale = 1.f / out_quant_arg->scale_; float bias = -in_quant_arg->zp_ * in_quant_arg->scale_; @@ -116,7 +116,7 @@ void Int8ArgMinMaxDim0(const int8_t *input, int8_t *output, const int *in_shape, } void Int8ArgMinMaxDim1(const int8_t *input, int8_t *output, const int *in_shape, ArgMinMaxParameter *param, - QuantArg *in_quant_arg, QuantArg *out_quant_arg) { + QuantArg *in_quant_arg, const QuantArg *out_quant_arg) { bool out_value = param->out_value_; const float output_inverse_scale = 1.f / out_quant_arg->scale_; float bias = -in_quant_arg->zp_ * in_quant_arg->scale_; @@ -147,7 +147,7 @@ void Int8ArgMinMaxDim1(const int8_t *input, int8_t *output, const int *in_shape, } void Int8ArgMinMaxDim2(const int8_t *input, int8_t *output, const int *in_shape, ArgMinMaxParameter *param, - QuantArg *in_quant_arg, QuantArg *out_quant_arg) { + QuantArg *in_quant_arg, const QuantArg *out_quant_arg) { bool out_value = param->out_value_; const float output_inverse_scale = 1.f / out_quant_arg->scale_; float bias = -in_quant_arg->zp_ * in_quant_arg->scale_; @@ -182,7 +182,7 @@ void Int8ArgMinMaxDim2(const int8_t *input, int8_t *output, const int *in_shape, } void Int8ArgMinMaxDim3(const int8_t *input, int8_t *output, const int *in_shape, ArgMinMaxParameter *param, - QuantArg *in_quant_arg, QuantArg *out_quant_arg) { + QuantArg *in_quant_arg, const QuantArg *out_quant_arg) { bool out_value = param->out_value_; const float output_inverse_scale = 1.f / out_quant_arg->scale_; float bias = -in_quant_arg->zp_ * in_quant_arg->scale_; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/arg_min_max_int8.h b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/arg_min_max_int8.h index d9ff90a2291..65ca274916f 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/arg_min_max_int8.h +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/arg_min_max_int8.h @@ -26,13 +26,13 @@ extern "C" { void Int8ArgMinMaxQuant(const int8_t *input, int8_t *output, const int *in_shape, const ArgMinMaxParameter *param, const QuantArg *in_quant, const QuantArg *out_quant); void Int8ArgMinMaxDim0(const int8_t *input, int8_t *output, const int *in_shape, ArgMinMaxParameter *param, - QuantArg *in_quant, QuantArg *out_quant); + QuantArg *in_quant, const QuantArg *out_quant); void Int8ArgMinMaxDim1(const int8_t *input, int8_t *output, const int *in_shape, ArgMinMaxParameter *param, - QuantArg *in_quant, QuantArg *out_quant); + QuantArg *in_quant, const QuantArg *out_quant); void Int8ArgMinMaxDim2(const int8_t *input, int8_t *output, const int *in_shape, ArgMinMaxParameter *param, - QuantArg *in_quant, QuantArg *out_quant); + QuantArg *in_quant, const QuantArg *out_quant); void Int8ArgMinMaxDim3(const int8_t *input, int8_t *output, const int *in_shape, ArgMinMaxParameter *param, - QuantArg *in_quant, QuantArg *out_quant); + QuantArg *in_quant, const QuantArg *out_quant); #ifdef __cplusplus } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/concat_int8.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/concat_int8.c index d6f0c0a8542..d8e803e07fa 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/concat_int8.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/concat_int8.c @@ -18,7 +18,8 @@ #include "nnacl/concat_parameter.h" #include -void Int8Concat(int8_t **inputs, int8_t *output, ConcatParameter *para, int axis, int64_t real_dst_count, int task_id) { +void Int8Concat(int8_t **inputs, int8_t *output, const ConcatParameter *para, int axis, int64_t real_dst_count, + int task_id) { float output_scale = para->quant_arg_.out_args_.scale_; const float output_inverse_scale = 1.f / output_scale; int input_num = para->input_num_; @@ -38,7 +39,7 @@ void Int8Concat(int8_t **inputs, int8_t *output, ConcatParameter *para, int axis for (int i = 0; i < input_num; i++) { const int *input_shape = para->input_shapes_[i]; int64_t in_copy_size = input_shape[axis] * after_axis_size; - int8_t *input_ptr = inputs[i] + k * in_copy_size; + const int8_t *input_ptr = inputs[i] + k * in_copy_size; if (input_quant[i].scale_ == output_scale && input_quant[i].zp_ == output_zp) { memcpy(output, input_ptr, in_copy_size); } else { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/concat_int8.h b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/concat_int8.h index 59136add39f..792c0cb499d 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/concat_int8.h +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/concat_int8.h @@ -23,7 +23,7 @@ #ifdef __cplusplus extern "C" { #endif -void Int8Concat(int8_t **inputs, int8_t *output_ptr, ConcatParameter *para, int axis, int64_t real_dst_count, +void Int8Concat(int8_t **inputs, int8_t *output_ptr, const ConcatParameter *para, int axis, int64_t real_dst_count, int task_id); #ifdef __cplusplus } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/crop_int8.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/crop_int8.c index 5e42735fafb..ad5bf472245 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/crop_int8.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/crop_int8.c @@ -18,7 +18,7 @@ #include "nnacl/int8/crop_int8.h" #include -void Int8Crop(const int8_t *input, int8_t *output, int task_id, CropParameter *para) { +void Int8Crop(const int8_t *input, int8_t *output, int task_id, const CropParameter *para) { int input_dim = para->input_dim_; switch (input_dim) { case 1: @@ -36,7 +36,7 @@ void Int8Crop(const int8_t *input, int8_t *output, int task_id, CropParameter *p } } -void Int8Crop1D(const int8_t *input, int8_t *output, int task_id, CropParameter *para) { +void Int8Crop1D(const int8_t *input, int8_t *output, int task_id, const CropParameter *para) { const int out_batch = para->out_shape_[0]; const int thread_count = para->thread_count_; int64_t task_id_stride = thread_count > 1 ? UP_DIV(out_batch, thread_count) : out_batch; @@ -75,7 +75,7 @@ void Int8Crop1D(const int8_t *input, int8_t *output, int task_id, CropParameter return; } -void Int8Crop2D(const int8_t *input, int8_t *output, int task_id, CropParameter *para) { +void Int8Crop2D(const int8_t *input, int8_t *output, int task_id, const CropParameter *para) { const int in_height = para->in_shape_[1]; const int out_batch = para->out_shape_[0]; const int out_height = para->out_shape_[1]; @@ -118,7 +118,7 @@ void Int8Crop2D(const int8_t *input, int8_t *output, int task_id, CropParameter return; } -void Int8Crop3D(const int8_t *input, int8_t *output, int task_id, CropParameter *para) { +void Int8Crop3D(const int8_t *input, int8_t *output, int task_id, const CropParameter *para) { const int in_height = para->in_shape_[1]; const int in_width = para->in_shape_[2]; @@ -173,7 +173,7 @@ void Int8Crop3D(const int8_t *input, int8_t *output, int task_id, CropParameter return; } -void Int8Crop4D(const int8_t *input, int8_t *output, int task_id, CropParameter *para) { +void Int8Crop4D(const int8_t *input, int8_t *output, int task_id, const CropParameter *para) { const int in_height = para->in_shape_[1]; const int in_width = para->in_shape_[2]; const int in_channel = para->in_shape_[3]; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/crop_int8.h b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/crop_int8.h index bbbad23f053..5646ac42070 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/crop_int8.h +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/crop_int8.h @@ -22,11 +22,11 @@ #ifdef __cplusplus extern "C" { #endif -void Int8Crop(const int8_t *input, int8_t *output, int task_id, CropParameter *para); -void Int8Crop1D(const int8_t *input, int8_t *output, int task_id, CropParameter *para); -void Int8Crop2D(const int8_t *input, int8_t *output, int task_id, CropParameter *para); -void Int8Crop3D(const int8_t *input, int8_t *output, int task_id, CropParameter *para); -void Int8Crop4D(const int8_t *input, int8_t *output, int task_id, CropParameter *para); +void Int8Crop(const int8_t *input, int8_t *output, int task_id, const CropParameter *para); +void Int8Crop1D(const int8_t *input, int8_t *output, int task_id, const CropParameter *para); +void Int8Crop2D(const int8_t *input, int8_t *output, int task_id, const CropParameter *para); +void Int8Crop3D(const int8_t *input, int8_t *output, int task_id, const CropParameter *para); +void Int8Crop4D(const int8_t *input, int8_t *output, int task_id, const CropParameter *para); #ifdef __cplusplus } #endif diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/leaky_relu_int8.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/leaky_relu_int8.c index 126a7628398..47a421eb56e 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/leaky_relu_int8.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/leaky_relu_int8.c @@ -17,7 +17,7 @@ #include "nnacl/int8/leaky_relu_int8.h" #include "nnacl/errorcode.h" -int DoLeakReluInt8(int8_t *inputs, int8_t *output_ptr, LeakyReluQuantArg *quant_prelu_parm, int task_id) { +int DoLeakReluInt8(const int8_t *inputs, int8_t *output_ptr, LeakyReluQuantArg *quant_prelu_parm, int task_id) { if (quant_prelu_parm == NULL) { return NNACL_NULL_PTR; } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/leaky_relu_int8.h b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/leaky_relu_int8.h index ee8808f3a25..7843b4bbd87 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/leaky_relu_int8.h +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/leaky_relu_int8.h @@ -23,7 +23,7 @@ #ifdef __cplusplus extern "C" { #endif -int DoLeakReluInt8(int8_t *inputs, int8_t *output_ptr, LeakyReluQuantArg *quant_Prelu_parm, int task_id); +int DoLeakReluInt8(const int8_t *inputs, int8_t *output_ptr, LeakyReluQuantArg *quant_Prelu_parm, int task_id); #ifdef __cplusplus } #endif diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/quantize.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/quantize.c index 2604ac900bb..c2501c4ab53 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/quantize.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/quantize.c @@ -102,7 +102,7 @@ void Quantize(const float *input_data, int length, float scale, int zero_point, } // dequantize from int8 to float -void Dequantize(int8_t *input_data, int length, float scale, int zero_point, float *output_data) { +void Dequantize(const int8_t *input_data, int length, float scale, int zero_point, float *output_data) { for (int i = 0; i < length; ++i) { output_data[i] = scale * (input_data[i] - zero_point); } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/quantize.h b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/quantize.h index 590c0362486..0d32c8a517a 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/quantize.h +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/quantize.h @@ -210,7 +210,7 @@ void CalculateActivationRangeQuantized(bool is_relu, bool is_relu6, int32_t zp, void Quantize(const float *input_data, int length, float scale, int zero_point, int8_t *output_data); // dequantize from int8 to float -void Dequantize(int8_t *input_data, int length, float scale, int zero_point, float *output_data); +void Dequantize(const int8_t *input_data, int length, float scale, int zero_point, float *output_data); #ifdef __cplusplus } diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/relux_int8.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/relux_int8.c index 339091a73d3..230e2bdd406 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/relux_int8.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/relux_int8.c @@ -15,7 +15,7 @@ */ #include "nnacl/int8/relux_int8.h" -void ReluXInt8(const int8_t *src, int length, int8_t *dst, ReluXQuantArg *arg) { +void ReluXInt8(const int8_t *src, int length, int8_t *dst, const ReluXQuantArg *arg) { for (int i = 0; i < length; ++i) { if (src[i] <= arg->input_arg.zp_) { dst[i] = arg->output_arg.zp_; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/relux_int8.h b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/relux_int8.h index 591f53a94d8..483ae9c7db5 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/relux_int8.h +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/relux_int8.h @@ -35,7 +35,7 @@ typedef struct ReluXQuantArg { #ifdef __cplusplus extern "C" { #endif -void ReluXInt8(const int8_t *src, int length, int8_t *dst, ReluXQuantArg *arg); +void ReluXInt8(const int8_t *src, int length, int8_t *dst, const ReluXQuantArg *arg); #ifdef __cplusplus } #endif diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/reshape_int8.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/reshape_int8.c index abdbe9bbdf5..aeef34034f0 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/reshape_int8.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/reshape_int8.c @@ -18,7 +18,7 @@ #include "nnacl/reshape_parameter.h" #include -void Int8Reshape(int8_t *input_ptr, int8_t *output_ptr, int64_t real_dst_count, ReshapeQuantArg para) { +void Int8Reshape(const int8_t *input_ptr, int8_t *output_ptr, int64_t real_dst_count, ReshapeQuantArg para) { if (para.in_args_.scale_ == para.out_args_.scale_ && para.in_args_.zp_ == para.out_args_.zp_) { memcpy(output_ptr, input_ptr, real_dst_count); } else { diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/reshape_int8.h b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/reshape_int8.h index cfe2045a79e..266806888f4 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/reshape_int8.h +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/reshape_int8.h @@ -24,7 +24,7 @@ #ifdef __cplusplus extern "C" { #endif -void Int8Reshape(int8_t *input_ptr, int8_t *output_ptr, int64_t real_dst_count, ReshapeQuantArg para); +void Int8Reshape(const int8_t *input_ptr, int8_t *output_ptr, int64_t real_dst_count, ReshapeQuantArg para); #ifdef __cplusplus } #endif diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/split_int8.c b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/split_int8.c index 208b01d50da..1fff8048e00 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/split_int8.c +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/split_int8.c @@ -19,29 +19,29 @@ #include #include "nnacl/errorcode.h" -int Int8DoSplit(int8_t *in_data, int8_t **out_data, const int *input_shape, int offset, int num_unit, - SplitParameter *param) { +int Int8DoSplit(const int8_t *in_data, int8_t **out_data, const int *input_shape, int offset, int num_unit, + const SplitParameter *param) { if (in_data == NULL || out_data == NULL) { return NNACL_ERR; } - int num_split = param->num_split_; - int *split_sizes = param->split_sizes_; - int *strides = param->strides_; - int split_dim = param->split_dim_; + const int num_split = param->num_split_; + const int *split_sizes = param->split_sizes_; + const int *strides = param->strides_; + const int split_dim = param->split_dim_; int in_stride = strides[split_dim]; int stride_per_split = in_stride * input_shape[split_dim]; int split_which = offset % num_split; int split_times = offset / num_split; - int8_t *src = in_data + split_times * stride_per_split; + const int8_t *src = in_data + split_times * stride_per_split; for (int i = 0; i < split_which; i++) { src += split_sizes[i] * in_stride; } - QuantArg in_quant_arg = param->quant_arg_.in_args_; + const QuantArg in_quant_arg = param->quant_arg_.in_args_; float in_scale = in_quant_arg.scale_; int32_t in_zp = in_quant_arg.zp_; - QuantArg *out_quant_arg = param->quant_arg_.out_args_; + const QuantArg *out_quant_arg = param->quant_arg_.out_args_; for (int i = offset; i < offset + num_unit; i++) { split_which = i % num_split; diff --git a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/split_int8.h b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/split_int8.h index 8933777e348..57315651e6c 100644 --- a/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/split_int8.h +++ b/mindspore/ccsrc/backend/kernel_compiler/cpu/nnacl/int8/split_int8.h @@ -24,8 +24,8 @@ #ifdef __cplusplus extern "C" { #endif -int Int8DoSplit(int8_t *in_data, int8_t **out_data, const int *input_shape, int offset, int num_unit, - SplitParameter *split_param); +int Int8DoSplit(const int8_t *in_data, int8_t **out_data, const int *input_shape, int offset, int num_unit, + const SplitParameter *split_param); #ifdef __cplusplus } #endif