Use RTNE as default rounding policy

RTNE, Round To Nearest Even is a better rounding policy
which aligns with implementation of Tensorflow Lite.

Signed-off-by: Kainan Cha <kainan.zha@verisilicon.com>
This commit is contained in:
Kainan Cha 2021-04-27 15:30:15 +08:00
parent eff71c38bf
commit 88f83019a8
2 changed files with 3 additions and 3 deletions

View File

@ -38,7 +38,7 @@ class OperationImpl {
OperationImpl& BindOutput(const std::shared_ptr<Tensor>& tensor);
OperationImpl& SetRoundingPolicy(
OverflowPolicy overflow_policy = OverflowPolicy::SATURATE,
RoundingPolicy rounding_policy = RoundingPolicy::TO_ZERO,
RoundingPolicy rounding_policy = RoundingPolicy::RTNE,
DownScaleSizeRounding down_scale_size_rounding =
DownScaleSizeRounding::FLOOR,
uint32_t accumulator_bits = 0);
@ -57,4 +57,4 @@ class OperationImpl {
} // namespace vx
} // namespace tim
#endif /* TIM_VX_OPERATION_PRIVATE_H_ */
#endif /* TIM_VX_OPERATION_PRIVATE_H_ */

View File

@ -129,7 +129,7 @@ vsi_enum TranslateRoundingPolicy(RoundingPolicy type) {
default:
break;
}
return VX_ROUND_POLICY_TO_ZERO;
return VX_ROUND_POLICY_TO_NEAREST_EVEN;
}
vsi_enum TranslateDownScaleSizeRounding(DownScaleSizeRounding type) {