Enhance negative operator for SYCL half conversion (#79850)

Enhance negative operator for SYCL half conversion with sycl::bit_cast implementation.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79850
Approved by: https://github.com/ngimel
This commit is contained in:
cchheennhhaaoo
2022-06-21 18:16:02 +00:00
committed by PyTorch MergeBot
parent 604f8d2ed5
commit 84564f2fab

View File

@@ -98,7 +98,7 @@ inline C10_HOST_DEVICE Half operator-(const Half& a) {
defined(__HIP_DEVICE_COMPILE__)
return __hneg(a);
#elif defined(__SYCL_DEVICE_ONLY__)
return -static_cast<sycl::half>(a);
return -sycl::bit_cast<sycl::half>(a);
#else
return -static_cast<float>(a);
#endif