Skip to content

Commit

Permalink
Merge pull request #82 from jelmervdl/fix-wasm-intgemm-nullptr
Browse files Browse the repository at this point in the history
Patch int8PrepareBias to handle nullptr
  • Loading branch information
XapaJIaMnu authored Mar 16, 2022
2 parents 53c4f7e + 6e40a8f commit 844800e
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/tensors/cpu/wasm_intgemm_fallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,19 @@ extern "C" void int8PrepareBiasFallback(const int8_t* input_B_prepared,
const float* input_bias,
float* output) {
float unquant_factor = (-1) * ((127.0f / scale_A) * (127.0f / scale_B)) / (127.0f);
intgemm::Int8Shift::PrepareBias(
input_B_prepared,
width,
cols_B,
intgemm::callbacks::UnquantizeAndAddBiasAndWrite(unquant_factor, input_bias, output));
if (input_bias) {
intgemm::Int8Shift::PrepareBias(
input_B_prepared,
width,
cols_B,
intgemm::callbacks::UnquantizeAndAddBiasAndWrite(unquant_factor, input_bias, output));
} else {
intgemm::Int8Shift::PrepareBias(
input_B_prepared,
width,
cols_B,
intgemm::callbacks::UnquantizeAndWrite(unquant_factor, output));
}
}

extern "C" void int8MultiplyAndAddBiasFallback(const int8_t* input_A_prepared,
Expand Down

0 comments on commit 844800e

Please sign in to comment.