Lines Matching full:zero_point
42 inline RequantizationTester& zero_point(int32_t zero_point) { in zero_point() argument
43 this->zero_point_ = zero_point; in zero_point()
47 inline int32_t zero_point() const { in zero_point() function
86 ASSERT_GE(zero_point(), std::numeric_limits<uint8_t>::min()); in TestExactDivideByPO2()
87 ASSERT_LE(zero_point(), std::numeric_limits<uint8_t>::max()); in TestExactDivideByPO2()
100 const int32_t max_i = (uint32_t(std::numeric_limits<int32_t>::max()) >> s()) + zero_point(); in TestExactDivideByPO2()
101 const int32_t min_i = -(-uint32_t(std::numeric_limits<int32_t>::min()) >> s()) + zero_point(); in TestExactDivideByPO2()
104 inputs[i] = int32_t(uint32_t(clamped_i - zero_point()) << s()); in TestExactDivideByPO2()
107 scale(), zero_point(), qmin(), qmax(), in TestExactDivideByPO2()
114 << ", s = " << s() << ", zero point = " << zero_point(); in TestExactDivideByPO2()
126 ASSERT_GE(zero_point(), std::numeric_limits<int8_t>::min()); in TestExactDivideByPO2()
127 ASSERT_LE(zero_point(), std::numeric_limits<int8_t>::max()); in TestExactDivideByPO2()
140 const int32_t max_i = (uint32_t(std::numeric_limits<int32_t>::max()) >> s()) + zero_point(); in TestExactDivideByPO2()
141 const int32_t min_i = -(-uint32_t(std::numeric_limits<int32_t>::min()) >> s()) + zero_point(); in TestExactDivideByPO2()
144 …inputs[i - std::numeric_limits<int8_t>::min()] = int32_t(uint32_t(clamped_i - zero_point()) << s()… in TestExactDivideByPO2()
147 scale(), zero_point(), qmin(), qmax(), in TestExactDivideByPO2()
155 << ", s = " << s() << ", zero point = " << zero_point(); in TestExactDivideByPO2()
167 ASSERT_GE(zero_point(), std::numeric_limits<uint8_t>::min()); in TestDivideByPO2WithRoundingUp()
168 ASSERT_LE(zero_point(), std::numeric_limits<uint8_t>::max()); in TestDivideByPO2WithRoundingUp()
182 const int64_t input = RequantizationTester::ShiftLeft(i - zero_point(), s()) - in TestDivideByPO2WithRoundingUp()
187 scale(), zero_point(), qmin(), qmax(), in TestDivideByPO2WithRoundingUp()
190 const int64_t input = RequantizationTester::ShiftLeft(i - zero_point(), s()) - in TestDivideByPO2WithRoundingUp()
195 << ", s = " << s() << ", zero point = " << zero_point(); in TestDivideByPO2WithRoundingUp()
208 ASSERT_GE(zero_point(), std::numeric_limits<int8_t>::min()); in TestDivideByPO2WithRoundingUp()
209 ASSERT_LE(zero_point(), std::numeric_limits<int8_t>::max()); in TestDivideByPO2WithRoundingUp()
223 const int64_t input = RequantizationTester::ShiftLeft(i - zero_point(), s()) - in TestDivideByPO2WithRoundingUp()
228 scale(), zero_point(), qmin(), qmax(), in TestDivideByPO2WithRoundingUp()
231 const int64_t input = RequantizationTester::ShiftLeft(i - zero_point(), s()) - in TestDivideByPO2WithRoundingUp()
236 << ", s = " << s() << ", zero point = " << zero_point(); in TestDivideByPO2WithRoundingUp()
249 ASSERT_GE(zero_point(), std::numeric_limits<uint8_t>::min()); in TestDivideByPO2WithRoundingDown()
250 ASSERT_LE(zero_point(), std::numeric_limits<uint8_t>::max()); in TestDivideByPO2WithRoundingDown()
264 const int64_t input = RequantizationTester::ShiftLeft(i - zero_point(), s()) + in TestDivideByPO2WithRoundingDown()
269 scale(), zero_point(), qmin(), qmax(), in TestDivideByPO2WithRoundingDown()
272 const int64_t input = RequantizationTester::ShiftLeft(i - zero_point(), s()) + in TestDivideByPO2WithRoundingDown()
277 << ", s = " << s() << ", zero point = " << zero_point(); in TestDivideByPO2WithRoundingDown()
290 ASSERT_GE(zero_point(), std::numeric_limits<int8_t>::min()); in TestDivideByPO2WithRoundingDown()
291 ASSERT_LE(zero_point(), std::numeric_limits<int8_t>::max()); in TestDivideByPO2WithRoundingDown()
305 const int64_t input = RequantizationTester::ShiftLeft(i - zero_point(), s()) + in TestDivideByPO2WithRoundingDown()
310 scale(), zero_point(), qmin(), qmax(), in TestDivideByPO2WithRoundingDown()
313 const int64_t input = RequantizationTester::ShiftLeft(i - zero_point(), s()) + in TestDivideByPO2WithRoundingDown()
318 << ", s = " << s() << ", zero point = " << zero_point(); in TestDivideByPO2WithRoundingDown()
324 ASSERT_GE(zero_point(), std::numeric_limits<uint8_t>::min()); in TestDivideByPO2WithRoundingTiesAway()
325 ASSERT_LE(zero_point(), std::numeric_limits<uint8_t>::max()); in TestDivideByPO2WithRoundingTiesAway()
339 int64_t input = RequantizationTester::ShiftLeft(i - zero_point(), s()); in TestDivideByPO2WithRoundingTiesAway()
348 scale(), zero_point(), qmin(), qmax(), in TestDivideByPO2WithRoundingTiesAway()
351 int64_t input = RequantizationTester::ShiftLeft(i - zero_point(), s()); in TestDivideByPO2WithRoundingTiesAway()
360 << ", s = " << s() << ", zero point = " << zero_point(); in TestDivideByPO2WithRoundingTiesAway()
366 ASSERT_GE(zero_point(), std::numeric_limits<int8_t>::min()); in TestDivideByPO2WithRoundingTiesAway()
367 ASSERT_LE(zero_point(), std::numeric_limits<int8_t>::max()); in TestDivideByPO2WithRoundingTiesAway()
381 int64_t input = RequantizationTester::ShiftLeft(i - zero_point(), s()); in TestDivideByPO2WithRoundingTiesAway()
390 scale(), zero_point(), qmin(), qmax(), in TestDivideByPO2WithRoundingTiesAway()
393 int64_t input = RequantizationTester::ShiftLeft(i - zero_point(), s()); in TestDivideByPO2WithRoundingTiesAway()
402 << ", s = " << s() << ", zero point = " << zero_point(); in TestDivideByPO2WithRoundingTiesAway()
408 ASSERT_GE(zero_point(), std::numeric_limits<int8_t>::min()); in TestDivideByPO2WithRoundingTiesUp()
409 ASSERT_LE(zero_point(), std::numeric_limits<int8_t>::max()); in TestDivideByPO2WithRoundingTiesUp()
423 int64_t input = RequantizationTester::ShiftLeft(i - zero_point(), s()); in TestDivideByPO2WithRoundingTiesUp()
428 scale(), zero_point(), qmin(), qmax(), in TestDivideByPO2WithRoundingTiesUp()
431 int64_t input = RequantizationTester::ShiftLeft(i - zero_point(), s()); in TestDivideByPO2WithRoundingTiesUp()
436 << ", s = " << s() << ", zero point = " << zero_point(); in TestDivideByPO2WithRoundingTiesUp()
452 for (int32_t zero_point = 0; zero_point <= std::numeric_limits<uint8_t>::max(); zero_point++) { in TestSpecialCases() local
457 zero_point /* zero point */, in TestSpecialCases()
462 …ASSERT_EQ(std::max(int32_t(int32_t(std::numeric_limits<uint8_t>::min())), zero_point - 1), int32_t… in TestSpecialCases()
491 for (int32_t zero_point = std::numeric_limits<int8_t>::min(); in TestSpecialCases() local
492 zero_point <= std::numeric_limits<int8_t>::max(); in TestSpecialCases()
493 zero_point++) in TestSpecialCases()
499 zero_point, in TestSpecialCases()
504 …ASSERT_EQ(std::max(int32_t(std::numeric_limits<int8_t>::min()), zero_point - 1), int32_t(outputs[i… in TestSpecialCases()
523 ASSERT_GE(zero_point(), std::numeric_limits<uint8_t>::min()); in TestRandomCasesRoundToNearestTiesAway()
524 ASSERT_LE(zero_point(), std::numeric_limits<uint8_t>::max()); in TestRandomCasesRoundToNearestTiesAway()
549 inputs.size(), inputs.data(), scale, zero_point(), qmin(), qmax(), in TestRandomCasesRoundToNearestTiesAway()
559 inputs[i], scale, zero_point(), qmin(), qmax()); in TestRandomCasesRoundToNearestTiesAway()
566 ASSERT_GE(zero_point(), std::numeric_limits<int8_t>::min()); in TestRandomCasesRoundToNearestTiesAway()
567 ASSERT_LE(zero_point(), std::numeric_limits<int8_t>::max()); in TestRandomCasesRoundToNearestTiesAway()
592 inputs.size(), inputs.data(), scale, zero_point(), qmin(), qmax(), in TestRandomCasesRoundToNearestTiesAway()
602 inputs[i], scale, zero_point(), qmin(), qmax()); in TestRandomCasesRoundToNearestTiesAway()
609 ASSERT_GE(zero_point(), std::numeric_limits<int8_t>::min()); in TestRandomCasesRoundToNearestTiesUp()
610 ASSERT_LE(zero_point(), std::numeric_limits<int8_t>::max()); in TestRandomCasesRoundToNearestTiesUp()
635 inputs.size(), inputs.data(), scale, zero_point(), qmin(), qmax(), in TestRandomCasesRoundToNearestTiesUp()
645 inputs[i], scale, zero_point(), qmin(), qmax()); in TestRandomCasesRoundToNearestTiesUp()
652 ASSERT_GE(zero_point(), std::numeric_limits<uint8_t>::min()); in TestRandomCasesApproximate()
653 ASSERT_LE(zero_point(), std::numeric_limits<uint8_t>::max()); in TestRandomCasesApproximate()
678 inputs.size(), inputs.data(), scale, zero_point(), qmin(), qmax(), in TestRandomCasesApproximate()
688 inputs[i], scale, uint8_t(zero_point()), uint8_t(qmin()), uint8_t(qmax())); in TestRandomCasesApproximate()
697 ASSERT_GE(zero_point(), std::numeric_limits<int8_t>::min()); in TestRandomCasesApproximate()
698 ASSERT_LE(zero_point(), std::numeric_limits<int8_t>::max()); in TestRandomCasesApproximate()
723 inputs.size(), inputs.data(), scale, zero_point(), qmin(), qmax(), in TestRandomCasesApproximate()
733 inputs[i], scale, int8_t(zero_point()), int8_t(qmin()), int8_t(qmax())); in TestRandomCasesApproximate()
748 uint8_t zero_point, in RequantizeApproximate() argument
755 …return std::min(std::max(double(value) * double(scale) + double(zero_point), double(qmin)), double… in RequantizeApproximate()
761 int8_t zero_point, in RequantizeApproximate() argument
768 …return std::min(std::max(double(value) * double(scale) + double(zero_point), double(qmin)), double… in RequantizeApproximate()