Skip to content

Commit

Permalink
[fme-apply] Apply abs to weight (#14243)
Browse files Browse the repository at this point in the history
This commit applies abs to weight.

ONE-DCO-1.0-Signed-off-by: seongwoo <[email protected]>
  • Loading branch information
mhs4670go authored Oct 24, 2024
1 parent f280955 commit a1612da
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/fme-apply/src/InsertScaleShift.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<loco::DataType::FLOAT32>(cur));
weight_max.at(i) =
std::max(weight_max.at(i), std::abs(weight->at<loco::DataType::FLOAT32>(cur)));
cur += weight_I;
}
}
Expand Down Expand Up @@ -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<loco::DataType::FLOAT32>(cur));
weight_max.at(i) =
std::max(weight_max.at(i), std::abs(weight->at<loco::DataType::FLOAT32>(cur)));
cur += weight_I;
}
}
Expand Down

0 comments on commit a1612da

Please sign in to comment.