diff --git a/compiler/fme-apply/src/InsertScaleShift.cpp b/compiler/fme-apply/src/InsertScaleShift.cpp index 27469a1327f..904128ed95f 100644 --- a/compiler/fme-apply/src/InsertScaleShift.cpp +++ b/compiler/fme-apply/src/InsertScaleShift.cpp @@ -125,7 +125,8 @@ bool calculate_smooth_quant_scale(luci::CircleNode *node, EqualizePattern *p) cur = i; for (uint32_t j = 0; j < norm_dim; j++) { - weight_max.at(i) = std::max(weight_max.at(i), weight->at(cur)); + weight_max.at(i) = + std::max(weight_max.at(i), std::abs(weight->at(cur))); cur += weight_I; } } @@ -166,7 +167,8 @@ bool calculate_smooth_quant_scale(luci::CircleNode *node, EqualizePattern *p) cur = i; for (uint32_t j = 0; j < weight_O; j++) { - weight_max.at(i) = std::max(weight_max.at(i), weight->at(cur)); + weight_max.at(i) = + std::max(weight_max.at(i), std::abs(weight->at(cur))); cur += weight_I; } }