!48792 Fix the precision problem for TruncateDiv

Merge pull request !48792 from zhanzhan/truncatediv
This commit is contained in:
i-robot 2023-02-14 02:52:12 +00:00 committed by Gitee
commit 5b6ffcf7ce
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 2 additions and 2 deletions

View File

@ -1123,8 +1123,8 @@ struct TruncateDivFunc {
template <>
struct TruncateDivFunc<half> {
__device__ __forceinline__ half operator()(const half &lhs, const half &rhs) {
float res = truncf(__half2float(lhs) / __half2float(rhs));
return __float2half_rn(res);
half res = __hdiv(lhs, rhs);
return res;
}
};