diff --git a/src/operators/math/gemm.cpp b/src/operators/math/gemm.cpp index 5d7f5dca44fa3aeffe5f095c4ad27b6d20771f7e..63cea79997e47f60877cc8fa9a2d04308032cd05 100644 --- a/src/operators/math/gemm.cpp +++ b/src/operators/math/gemm.cpp @@ -674,11 +674,19 @@ void InnerKernelWithBias(int mc, int nc, float alpha, const float *a, return; } if (beta == 1 && !relu) { - WriteWithAddV1(mc, nc, c, C, ldc, bias); + if (bias == nullptr) { + WriteWithAdd(mc, nc, c, C, ldc); + } else { + WriteWithAddV1(mc, nc, c, C, ldc, bias); + } return; } if (beta == 1 && relu) { - WriteWithAddReluV1(mc, nc, c, C, ldc, bias); + if (bias == nullptr) { + WriteWithAddRelu(mc, nc, c, C, ldc); + } else { + WriteWithAddReluV1(mc, nc, c, C, ldc, bias); + } return; } }