From 5c658f7e582db379e63fc267019b32664868f799 Mon Sep 17 00:00:00 2001 From: zhaojiaying01 Date: Tue, 6 Nov 2018 12:04:45 +0800 Subject: [PATCH] fix gemm Sgemm_omp when bias = nullptr --- src/operators/math/gemm.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/operators/math/gemm.cpp b/src/operators/math/gemm.cpp index 44621ba99a..605fa17c3c 100644 --- a/src/operators/math/gemm.cpp +++ b/src/operators/math/gemm.cpp @@ -3307,8 +3307,13 @@ void Gemm::Sgemm_omp(int m, int n, int k, float alpha, const float *A, int lda, float *local_A = packedA + MC * KC * local_threads; float *local_C = packedC + MC * NC * local_threads; (*this.*procPackA)(mc, KC, mc % MR, &A(i, 0), lda, local_A); - InnerKernelWithBias(mc, n, alpha, local_A, packedB, beta, local_C, - &C(i, 0), ldc, relu, bias + i); + if (bias == nullptr) { + InnerKernelWithBias(mc, n, alpha, local_A, packedB, beta, local_C, + &C(i, 0), ldc, relu, nullptr); + } else { + InnerKernelWithBias(mc, n, alpha, local_A, packedB, beta, local_C, + &C(i, 0), ldc, relu, bias + i); + } } } else { #pragma omp parallel for -- GitLab