!6264 【MSLITE】change local variables to const

Merge pull request !6264 from lz/master
pull/6264/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit ab534d6171

@ -33,13 +33,13 @@ static void meanVar(const float *in, int size, int ch, float eps, float *mean, f
for (int f = 0; f < ch; ++f) {
mean[f] /= N;
}
for (int f=0; f< ch; f++) {
for (int f = 0; f < ch; f++) {
float tvar = 0;
for (int i =0; i< N; i++) {
float x = in[i*ch +f];
tvar += (x-mean[f]) *(x-mean[f]);
for (int i = 0; i < N; i++) {
float x = in[i * ch + f];
tvar += (x - mean[f]) * (x - mean[f]);
}
invar[f] = 1.0f/(sqrt(tvar/N+eps));
invar[f] = 1.0f / (sqrt(tvar / N + eps));
}
}

@ -39,9 +39,9 @@ void SoftmaxGrad(const float *input_ptr, const float *yt_ptr, float *output_ptr,
dim /= outter_size;
memcpy(output_ptr, yt_ptr, ele_size * sizeof(float));
int M = input_shape[axis];
int N = inner_size;
int K = 1;
const int M = input_shape[axis];
const int N = inner_size;
const int K = 1;
for (int i = 0; i < outter_size; i++) {
int outter_offset = i * dim;
memset(sum_data, 0.0f, inner_size * sizeof(float));

@ -51,6 +51,7 @@ int Executor::Run(std::vector<Tensor *> &in_tensors, std::vector<Tensor *> &out_
MS_LOG(ERROR) << "run kernel before_callback failed, name: " << kernel->name();
}
}
auto ret = kernel->Run();
if (0 != ret) {
MS_LOG(ERROR) << "run kernel failed, name: " << kernel->name();

Loading…
Cancel
Save