diff --git a/onnxruntime/contrib_ops/cpu/skip_layer_norm.cc b/onnxruntime/contrib_ops/cpu/skip_layer_norm.cc index 4f3b49c0a7250..9dea120949bdf 100644 --- a/onnxruntime/contrib_ops/cpu/skip_layer_norm.cc +++ b/onnxruntime/contrib_ops/cpu/skip_layer_norm.cc @@ -156,9 +156,9 @@ void ComputeJob( mean_square = sqrt(mean_square / hidden_size - mean * mean + epsilon); } - float* float_gamma = float_input; // overwrite float_input with gamma values, since they have the same size + float* float_gamma = float_input; // overwrite float_input with gamma values, since they have the same size MlasConvertHalfToFloatBuffer(gamma_data, float_gamma, num_elems); - float* float_beta = float_skip; // overwrite float_input with beta values, since they have the same size + float* float_beta = float_skip; // overwrite float_skip with beta values, since they have the same size MlasConvertHalfToFloatBuffer(beta_data, float_beta, num_elems); for (size_t h = 0; h < num_elems; h++) { if (simplified) { @@ -169,8 +169,8 @@ void ComputeJob( float_output[h] = (float_output[h] - mean) / mean_square * float_gamma[h] + float_beta[h]; } } - delete[] float_gamma; // also deletes float_input - delete[] float_beta; // also deletes float_skip + delete[] float_gamma; // also deletes float_input + delete[] float_beta; // also deletes float_skip MlasConvertFloatToHalfBuffer(float_output, p_output, num_elems); delete[] float_output; diff --git a/onnxruntime/core/providers/cpu/nn/layer_norm_impl.cc b/onnxruntime/core/providers/cpu/nn/layer_norm_impl.cc index 1c40071d60f7c..44e1ee9c078bf 100644 --- a/onnxruntime/core/providers/cpu/nn/layer_norm_impl.cc +++ b/onnxruntime/core/providers/cpu/nn/layer_norm_impl.cc @@ -104,7 +104,7 @@ void ComputeJob( mean_square = sqrt(mean_square / norm_size - mean * mean + epsilon); } - float* float_scale = float_input; // overwrite float_input with scale values, since they have the same size + float* float_scale = float_input; // overwrite float_input with scale values, since they have the same size MlasConvertHalfToFloatBuffer(scale_data, float_scale, num_elems); float* float_bias = new float[num_elems]; MlasConvertHalfToFloatBuffer(bias_data, float_bias, num_elems); @@ -117,7 +117,7 @@ void ComputeJob( float_output[h] = (float_output[h] - mean) / mean_square * float_scale[h] + float_bias[h]; } } - delete[] float_scale; // also deletes float_input + delete[] float_scale; // also deletes float_input delete[] float_bias; MlasConvertFloatToHalfBuffer(float_output, p_output, num_elems); @@ -228,7 +228,7 @@ Status LayerNormImpl::ComputeWithoutContext( thread_pool, static_cast(norm_count), [&](ptrdiff_t task_idx) { ComputeJob(X_data, scale_data, bias_data, task_idx, norm_size, epsilon, simplified, - Y_data, mean_data, inv_std_dev_data); + Y_data, mean_data, inv_std_dev_data); }, 0);