Skip to content

Commit 3d4114c

Browse files
authored
fix gemv mem no init bug test=develop (#9910)
1 parent 3bd55b5 commit 3d4114c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lite/kernels/arm/fc_compute.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ void fc_trans_weights<PRECISION(kInt8)>(const Tensor& tin, Tensor* tout) {
5959
CHECK_EQ(tin.dims().size(), 2) << "fc weights size must = 2";
6060
int m = tin.dims()[0];
6161
int n = tin.dims()[1];
62-
tout->Resize({n, m});
62+
tout->Resize({(n - 1) * m + (m + 15) / 16 * 16});
6363
auto* ptr_in = tin.data<int8_t>();
6464
auto* ptr_out = tout->mutable_data<int8_t>();
65+
memset(ptr_out, 0, tout->dims().production() * sizeof(int8_t));
6566
naive_transpose(ptr_in, ptr_out, m, n);
6667
}
6768

@@ -367,9 +368,10 @@ void fc_trans_weights<PRECISION(kFP16)>(const Tensor& tin, Tensor* tout) {
367368
CHECK_EQ(tin.dims().size(), 2) << "fc weights size must = 2";
368369
int m = tin.dims()[0];
369370
int n = tin.dims()[1];
370-
tout->Resize({n, m});
371+
tout->Resize({(n - 1) * m + (m + 15) / 16 * 16});
371372
auto* ptr_in = tin.data<float16_t>();
372373
auto* ptr_out = tout->mutable_data<float16_t>();
374+
memset(ptr_out, 0, tout->dims().production() * sizeof(float16_t));
373375
naive_transpose(ptr_in, ptr_out, m, n);
374376
}
375377

0 commit comments

Comments
 (0)