Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
amarin16 committed Oct 2, 2024
1 parent 766c4b2 commit cb55d4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions onnxruntime/contrib_ops/cpu/skip_layer_norm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions onnxruntime/core/providers/cpu/nn/layer_norm_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -228,7 +228,7 @@ Status LayerNormImpl::ComputeWithoutContext(
thread_pool, static_cast<int32_t>(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);

Expand Down

0 comments on commit cb55d4b

Please sign in to comment.