Skip to content

Commit 245f298

Browse files
committed
fix some lint errors
1 parent 405a0a0 commit 245f298

File tree

2 files changed

+13
-25
lines changed

2 files changed

+13
-25
lines changed

onnxruntime/contrib_ops/cpu/skip_layer_norm.cc

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,15 @@ REGISTER_KERNEL_TYPED(MLFloat16)
4040

4141
namespace {
4242

43-
ORT_FORCEINLINE double* CreateBufferIfMLFloat16(double* p_output, int num_elems)
44-
{
43+
ORT_FORCEINLINE double* CreateBufferIfMLFloat16(double* p_output, int num_elems) {
4544
return p_output;
4645
}
4746

48-
ORT_FORCEINLINE float* CreateBufferIfMLFloat16(float* p_output, int num_elems)
49-
{
47+
ORT_FORCEINLINE float* CreateBufferIfMLFloat16(float* p_output, int num_elems) {
5048
return p_output;
5149
}
5250

53-
ORT_FORCEINLINE float* CreateBufferIfMLFloat16(MLFloat16* p_output, int num_elems)
54-
{
51+
ORT_FORCEINLINE float* CreateBufferIfMLFloat16(MLFloat16* p_output, int num_elems) {
5552
return p_output == nullptr ? nullptr : new float[num_elems];
5653
}
5754

@@ -61,14 +58,12 @@ ORT_FORCEINLINE std::shared_ptr<std::vector<float>> ConvertHalfToFloatBufferIfNe
6158

6259
template <typename T>
6360
ORT_FORCEINLINE std::shared_ptr<std::vector<float>> ConvertHalfToFloatBufferIfNeeded(
64-
const std::enable_if_t<std::is_same_v<T,float> || std::is_same_v<T, double>, T>* p_input, int num_elems)
65-
{
61+
const std::enable_if_t<std::is_same_v<T,float> || std::is_same_v<T, double>, T>* p_input, int num_elems) {
6662
return nullptr;
6763
}
6864

6965
template<>
70-
std::shared_ptr<std::vector<float>> ConvertHalfToFloatBufferIfNeeded<MLFloat16>(const MLFloat16* p_input, int num_elems)
71-
{
66+
std::shared_ptr<std::vector<float>> ConvertHalfToFloatBufferIfNeeded<MLFloat16>(const MLFloat16* p_input, int num_elems) {
7267
if (!p_input) {
7368
return nullptr;
7469
}
@@ -81,8 +76,7 @@ std::shared_ptr<std::vector<float>> ConvertHalfToFloatBufferIfNeeded<MLFloat16>(
8176
}
8277

8378

84-
void ConvertFloatBufferToMLFloat16(const float* output_buffer, MLFloat16* p_output, int num_elems)
85-
{
79+
void ConvertFloatBufferToMLFloat16(const float* output_buffer, MLFloat16* p_output, int num_elems) {
8680
if (!output_buffer || !p_output) {
8781
return;
8882
}

onnxruntime/core/providers/cpu/nn/layer_norm_impl.cc

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,30 @@ namespace onnxruntime {
1515

1616
namespace {
1717

18-
ORT_FORCEINLINE double* OnlyCreateBufferIfMLFloat16(double* p_output, int num_elems)
19-
{
18+
ORT_FORCEINLINE double* OnlyCreateBufferIfMLFloat16(double* p_output, int num_elems) {
2019
return p_output;
2120
}
2221

23-
ORT_FORCEINLINE float* OnlyCreateBufferIfMLFloat16(float* p_output, int num_elems)
24-
{
22+
ORT_FORCEINLINE float* OnlyCreateBufferIfMLFloat16(float* p_output, int num_elems) {
2523
return p_output;
2624
}
2725

28-
ORT_FORCEINLINE float* OnlyCreateBufferIfMLFloat16(MLFloat16* p_output, int num_elems)
29-
{
26+
ORT_FORCEINLINE float* OnlyCreateBufferIfMLFloat16(MLFloat16* p_output, int num_elems) {
3027
return p_output == nullptr ? nullptr : new float[num_elems];
3128
}
3229

3330

3431
template <typename T>
35-
ORT_FORCEINLINE std::shared_ptr<std::vector<float>> ConvertMLFloat16ToFloatBufferIfNeeded(const T* p_input, int num_elems);
32+
ORT_FORCEINLINE std::shared_ptr<std::vector<float>> ConvertMLFloat16ToFloatBufferIfNeeded(const T* p_input, int64_t num_elems);
3633

3734
template <typename T>
3835
ORT_FORCEINLINE std::shared_ptr<std::vector<float>> ConvertMLFloat16ToFloatBufferIfNeeded(
39-
const std::enable_if_t<std::is_same_v<T, float> || std::is_same_v<T, double>, T>* p_input, int num_elems)
40-
{
36+
const std::enable_if_t<std::is_same_v<T, float> || std::is_same_v<T, double>, T>* p_input, int64_t num_elems) {
4137
return nullptr;
4238
}
4339

4440
template<>
45-
std::shared_ptr<std::vector<float>> ConvertMLFloat16ToFloatBufferIfNeeded<MLFloat16>(const MLFloat16* p_input, int num_elems)
46-
{
41+
std::shared_ptr<std::vector<float>> ConvertMLFloat16ToFloatBufferIfNeeded<MLFloat16>(const MLFloat16* p_input, int64_t num_elems) {
4742
if (!p_input) {
4843
return nullptr;
4944
}
@@ -56,8 +51,7 @@ std::shared_ptr<std::vector<float>> ConvertMLFloat16ToFloatBufferIfNeeded<MLFloa
5651
}
5752

5853

59-
void ConvertFloatBufferToMLFloat16(const float* output_buffer, MLFloat16* p_output, int num_elems)
60-
{
54+
void ConvertFloatBufferToMLFloat16(const float* output_buffer, MLFloat16* p_output, int64_t num_elems) {
6155
if (!output_buffer || !p_output) {
6256
return;
6357
}

0 commit comments

Comments
 (0)