[CPU] Correct crop in FQ optimized formula (#16887)

This commit is contained in:
Egor Duplenskii 2023-04-14 08:43:05 +02:00 committed by GitHub
parent a7228534af
commit e98bd0dae4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1994,6 +1994,9 @@ void FakeQuantize::updateOptimizedFormula(bool do_rounding) {
// merged with inputScale/inputShift with updated cropLow/cropHigh
clo = clo * osc + osh;
chi = chi * osc + osh;
if (clo > chi)
std::swap(clo, chi);
// crop(x*isc + ish, a, b)*osc + osh
// crop(x*isc*osc + ish*osc + osh, a', b')
isc = isc * osc;