[普通]【Tensorflow】more than one instance of overloaded function "_

作者(passion) 阅读(1320次) 评论(0) 分类( 软件)

在win 10以bazel方式源码构建tensorflow 1.12的过程中,报如下错误:


more than one instance of overloaded function "__hadd" matches the argument list:
            function "__hadd(int, int)"
            function "__hadd(__half, __half)"
            argument types are: (const Eigen::half, const Eigen::half)

是因为Eigen本身的bug,解决方法是修改tensorflow-master\bazel-tensorflow-master\external\eigen_archive\Eigen\src\Core\arch\CUDA\Half.h的代码:



EIGEN_STRONG_INLINE __device__ half operator + (const half& a, const half& b) {
  return __hadd(a, b);
}

修改为:


 EIGEN_STRONG_INLINE __device__ half operator + (const half& a, const half& b) {
 #if defined(EIGEN_CUDACC_VER) && EIGEN_CUDACC_VER >= 90000
   return __hadd(::__half(a), ::__half(b));
 #else
   return __hadd(a, b);
 #endif
 }


EIGEN_STRONG_INLINE __device__ half operator / (const half& a, const half& b) {
  float num = __half2float(a);
  float denom = __half2float(b);
  return __float2half(num / denom);
}

修改为:


EIGEN_STRONG_INLINE __device__ half operator / (const half& a, const half& b) {
 #if defined(EIGEN_CUDACC_VER) && EIGEN_CUDACC_VER >= 90000
   return __hdiv(a, b);
 #else
   float num = __half2float(a);
   float denom = __half2float(b);
   return __float2half(num / denom);
 #endif
 }


« 上一篇:wifi共享上网(至尊版wifi)
« 下一篇:从Transformer、BERT到GPT2和XLNet:高端玩家如何用论文互怼
在这里写下您精彩的评论
  • 微信

  • QQ

  • 支付宝

返回首页
返回首页 img
返回顶部~
返回顶部 img