Browse Source

Fix Innerproduct gemm forgot to add an offset of w in int8 forward (#3084)

tags/20210720
lsdustc GitHub 4 years ago
parent
commit
61af40cfbd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions
  1. +1
    -2
      src/layer/innerproduct.cpp

+ 1
- 2
src/layer/innerproduct.cpp View File

@@ -262,18 +262,17 @@ int InnerProduct::forward_int8(const Mat& bottom_blob, Mat& top_blob, const Opti
for (int j = 0; j < h; j++) for (int j = 0; j < h; j++)
{ {
const signed char* m = bottom_blob_int8.row<signed char>(j); const signed char* m = bottom_blob_int8.row<signed char>(j);
const signed char* kptr = weight_data;
float* outptr = top_blob.row(j); float* outptr = top_blob.row(j);


for (int p = 0; p < num_output; p++) for (int p = 0; p < num_output; p++)
{ {
const signed char* kptr = (const signed char*)weight_data + w * p;
int sum = 0; int sum = 0;


for (int i = 0; i < w; i++) for (int i = 0; i < w; i++)
{ {
sum += m[i] * kptr[i]; sum += m[i] * kptr[i];
} }

// dequantize and relu // dequantize and relu
float scale_in; float scale_in;
if (weight_data_int8_scales[p] == 0) if (weight_data_int8_scales[p] == 0)


Loading…
Cancel
Save