Skip to content

Commit

Permalink
q
Browse files Browse the repository at this point in the history
  • Loading branch information
nihui committed Feb 5, 2025
1 parent 2bb287c commit b961c2e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/layer/arm/requantize_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ static void requantize_relu(const int* intptr, signed char* ptr, const Mat& scal
for (; i < size; i++)
{
float v = *intptr * scale;
if (v < 0) v = 0;
*ptr = float2int8(v);
if (*ptr < 0) *ptr = 0;
intptr++;
ptr++;
}
Expand Down Expand Up @@ -190,8 +190,8 @@ static void requantize_relu(const int* intptr, signed char* ptr, const Mat& scal
for (; i < size; i++)
{
float v = *intptr * scale + bias;
if (v < 0) v = 0;
*ptr = float2int8(v);
if (*ptr < 0) *ptr = 0;
intptr++;
ptr++;
}
Expand Down Expand Up @@ -288,8 +288,8 @@ static void requantize_leakyrelu(const int* intptr, signed char* ptr, const Mat&
for (; i < size; i++)
{
float v = *intptr * scale;
if (v < 0) v *= slope;
*ptr = float2int8(v);
if (*ptr < 0) *ptr *= slope;
intptr++;
ptr++;
}
Expand Down Expand Up @@ -358,8 +358,8 @@ static void requantize_leakyrelu(const int* intptr, signed char* ptr, const Mat&
for (; i < size; i++)
{
float v = *intptr * scale + bias;
if (v < 0) v *= slope;
*ptr = float2int8(v);
if (*ptr < 0) *ptr *= slope;
intptr++;
ptr++;
}
Expand Down
8 changes: 4 additions & 4 deletions src/layer/loongarch/requantize_loongarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ static void requantize_relu(const int* intptr, signed char* ptr, const Mat& scal
for (; i < size; i++)
{
float v = *intptr * scale;
if (v < 0) v = 0;
*ptr = float2int8(v);
if (*ptr < 0) *ptr = 0;
intptr++;
ptr++;
}
Expand Down Expand Up @@ -182,8 +182,8 @@ static void requantize_relu(const int* intptr, signed char* ptr, const Mat& scal
for (; i < size; i++)
{
float v = *intptr * scale + bias;
if (v < 0) v = 0;
*ptr = float2int8(v);
if (*ptr < 0) *ptr = 0;
intptr++;
ptr++;
}
Expand Down Expand Up @@ -281,8 +281,8 @@ static void requantize_leakyrelu(const int* intptr, signed char* ptr, const Mat&
for (; i < size; i++)
{
float v = *intptr * scale;
if (v < 0) v *= slope;
*ptr = float2int8(v);
if (*ptr < 0) *ptr *= slope;
intptr++;
ptr++;
}
Expand Down Expand Up @@ -343,8 +343,8 @@ static void requantize_leakyrelu(const int* intptr, signed char* ptr, const Mat&
for (; i < size; i++)
{
float v = *intptr * scale + bias;
if (v < 0) v *= slope;
*ptr = float2int8(v);
if (*ptr < 0) *ptr *= slope;
intptr++;
ptr++;
}
Expand Down
8 changes: 4 additions & 4 deletions src/layer/mips/requantize_mips.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ static void requantize_relu(const int* intptr, signed char* ptr, const Mat& scal
for (; i < size; i++)
{
float v = *intptr * scale;
if (v < 0) v = 0;
*ptr = float2int8(v);
if (*ptr < 0) *ptr = 0;
intptr++;
ptr++;
}
Expand Down Expand Up @@ -182,8 +182,8 @@ static void requantize_relu(const int* intptr, signed char* ptr, const Mat& scal
for (; i < size; i++)
{
float v = *intptr * scale + bias;
if (v < 0) v = 0;
*ptr = float2int8(v);
if (*ptr < 0) *ptr = 0;
intptr++;
ptr++;
}
Expand Down Expand Up @@ -281,8 +281,8 @@ static void requantize_leakyrelu(const int* intptr, signed char* ptr, const Mat&
for (; i < size; i++)
{
float v = *intptr * scale;
if (v < 0) v *= slope;
*ptr = float2int8(v);
if (*ptr < 0) *ptr *= slope;
intptr++;
ptr++;
}
Expand Down Expand Up @@ -343,8 +343,8 @@ static void requantize_leakyrelu(const int* intptr, signed char* ptr, const Mat&
for (; i < size; i++)
{
float v = *intptr * scale + bias;
if (v < 0) v *= slope;
*ptr = float2int8(v);
if (*ptr < 0) *ptr *= slope;
intptr++;
ptr++;
}
Expand Down

0 comments on commit b961c2e

Please sign in to comment.