Fix the precision problem for TruncateDiv.

This commit is contained in:
zhanzhan1 2023-02-13 20:02:48 +08:00
parent 9757d9da18
commit 931a0b254e
1 changed files with 2 additions and 2 deletions

View File

@ -1117,8 +1117,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;
}
};