Created
August 16, 2018 03:28
-
-
Save bstriner/e11afeddf002640ee6a773ab0e6bb9b3 to your computer and use it in GitHub Desktop.
TensorFlow patch for eigen3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- eigen_archive/Eigen/src/Core/arch/CUDA/Half.h 2018-06-22 18:09:44.000000000 -0400 | |
+++ eigen_archive/Eigen/src/Core/arch/CUDA/Half.h 2018-07-25 01:19:55.462313100 -0400 | |
@@ -209,7 +209,7 @@ | |
// conversion steps back and forth. | |
EIGEN_STRONG_INLINE __device__ half operator + (const half& a, const half& b) { | |
- return __hadd(a, b); | |
+ return __hadd(::__half(a), ::__half(b)); | |
} | |
EIGEN_STRONG_INLINE __device__ half operator * (const half& a, const half& b) { | |
return __hmul(a, b); | |
@@ -218,9 +218,7 @@ | |
return __hsub(a, b); | |
} | |
EIGEN_STRONG_INLINE __device__ half operator / (const half& a, const half& b) { | |
- float num = __half2float(a); | |
- float denom = __half2float(b); | |
- return __float2half(num / denom); | |
+ return __hdiv(a, b); | |
} | |
EIGEN_STRONG_INLINE __device__ half operator - (const half& a) { | |
return __hneg(a); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Save file to
tensorflow
folder and addpatch_file="//tensorflow:[filename.txt]"
to eigen3 library inworkspace.bzl
.