Browse Source

constraint input value to [-127, +127] (#1258)

* constraint input value to [-127, +127]

* keep new line at the end
tags/20191113
tpoisonooo nihui 6 years ago
parent
commit
8dbafe7764
9 changed files with 10 additions and 10 deletions
  1. +1
    -1
      src/layer/arm/convolution_1x1_int8.h
  2. +1
    -1
      src/layer/arm/convolutiondepthwise_3x3_int8.h
  3. +1
    -1
      src/layer/arm/quantize_arm.cpp
  4. +1
    -1
      src/layer/arm/requantize_arm.cpp
  5. +1
    -1
      src/layer/quantize.cpp
  6. +1
    -1
      src/layer/requantize.cpp
  7. +1
    -1
      src/layer/x86/convolution_sgemm_int8.h
  8. +1
    -1
      src/layer/x86/convolutiondepthwise_3x3_int8.h
  9. +2
    -2
      tools/caffe/caffe2ncnn.cpp

+ 1
- 1
src/layer/arm/convolution_1x1_int8.h View File

@@ -19,7 +19,7 @@ static inline signed char float2int8(float v)
{
int int32 = round(v);
if (int32 > 127) return 127;
if (int32 < -128) return -128;
if (int32 < -127) return -127;
return (signed char)int32;
}



+ 1
- 1
src/layer/arm/convolutiondepthwise_3x3_int8.h View File

@@ -16,7 +16,7 @@ static inline signed char float2int8(float v)
{
int int32 = round(v);
if (int32 > 127) return 127;
if (int32 < -128) return -128;
if (int32 < -127) return -127;
return (signed char)int32;
}



+ 1
- 1
src/layer/arm/quantize_arm.cpp View File

@@ -25,7 +25,7 @@ static inline signed char float2int8(float v)
{
int int32 = round(v);
if (int32 > 127) return 127;
if (int32 < -128) return -128;
if (int32 < -127) return -127;
return (signed char)int32;
}



+ 1
- 1
src/layer/arm/requantize_arm.cpp View File

@@ -28,7 +28,7 @@ static inline signed char float2int8(float v)
{
int int32 = round(v);
if (int32 > 127) return 127;
if (int32 < -128) return -128;
if (int32 < -127) return -127;
return (signed char)int32;
}



+ 1
- 1
src/layer/quantize.cpp View File

@@ -37,7 +37,7 @@ static inline signed char float2int8(float v)
{
int int32 = round(v);
if (int32 > 127) return 127;
if (int32 < -128) return -128;
if (int32 < -127) return -127;
return (signed char)int32;
}



+ 1
- 1
src/layer/requantize.cpp View File

@@ -31,7 +31,7 @@ static inline signed char float2int8(float v)
{
int int32 = round(v);
if (int32 > 127) return 127;
if (int32 < -128) return -128;
if (int32 < -127) return -127;
return (signed char)int32;
}



+ 1
- 1
src/layer/x86/convolution_sgemm_int8.h View File

@@ -16,7 +16,7 @@ static inline signed char float2int8(float v)
{
int int32 = round(v);
if (int32 > 127) return 127;
if (int32 < -128) return -128;
if (int32 < -127) return -127;
return (signed char)int32;
}



+ 1
- 1
src/layer/x86/convolutiondepthwise_3x3_int8.h View File

@@ -16,7 +16,7 @@ static inline signed char float2int8(float v)
{
int int32 = round(v);
if (int32 > 127) return 127;
if (int32 < -128) return -128;
if (int32 < -127) return -127;
return (signed char)int32;
}



+ 2
- 2
tools/caffe/caffe2ncnn.cpp View File

@@ -108,8 +108,8 @@ static signed char float2int8(float value)

if (tmp > 127)
return 127;
if (tmp < -128)
return -128;
if (tmp < -127)
return -127;

return tmp;
}


Loading…
Cancel
Save