diff --git a/mace/kernels/batch_norm.h b/mace/kernels/batch_norm.h index d81fdae9849d58d8357f4cccf14704e7e4bbbb84..136163f9cae9b23d856be5f20b84c21408e7a347 100644 --- a/mace/kernels/batch_norm.h +++ b/mace/kernels/batch_norm.h @@ -47,7 +47,7 @@ struct BatchNormFunctor : public BatchNormFunctorBase { new_offset = offset[c] - mean[c] * new_scale; for (TIndex i = 0; i < n; ++i) { - TIndex pos = i * channel * sample_size + c * sample_size; + TIndex pos = (i * channel + c) * sample_size; const T* input_sample_ptr = input + pos; T* output_sample_ptr = output + pos; for (TIndex j = 0; j < sample_size; ++j) { diff --git a/mace/kernels/neon/batch_norm_neon.cc b/mace/kernels/neon/batch_norm_neon.cc index d307173f4a072fc58dad63fe9d2966f8c5ab2961..7121c23dfb773115dc4ba56d588a544f653bd76c 100644 --- a/mace/kernels/neon/batch_norm_neon.cc +++ b/mace/kernels/neon/batch_norm_neon.cc @@ -41,7 +41,7 @@ struct BatchNormFunctor : public BatchNormFunctorBase