1
0
Fork 0
TheChymera-overlay/sci-libs/pytorch/files/0010-Remove-conversion-ambi...

39 lines
1.4 KiB
Diff

From 0f3a0d9a948fdd8481a5f7751a255ecd9ed4d37a Mon Sep 17 00:00:00 2001
From: Alexey Chernov <4ernov@gmail.com>
Date: Mon, 20 Jan 2020 01:21:22 +0300
Subject: [PATCH 3/3] Remove conversion ambiguity in ternary operators
It fails to compile with recent versions of Clang
(namely, version 10 used behind HCC compiler when
being built with ROCm support) with the
`conditional expression is ambiguous` error.
---
caffe2/operators/relu_op.cu | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/caffe2/operators/relu_op.cu b/caffe2/operators/relu_op.cu
index f6edf7105e..ab49540fc9 100644
--- a/caffe2/operators/relu_op.cu
+++ b/caffe2/operators/relu_op.cu
@@ -51,7 +51,7 @@ __global__ void ReluCUDAKernel<half2>(const int N, const half2* X, half2* Y) {
#else
const float2 xx = __half22float2(X[i]);
Y[i] =
- __floats2half2_rn(xx.x > 0.0f ? xx.x : 0.0f, xx.y > 0.0f ? xx.y : 0.0f);
+ __floats2half2_rn(xx.x > 0.0f ? float(xx.x) : 0.0f, xx.y > 0.0f ? float(xx.y) : 0.0f);
#endif
}
}
@@ -101,7 +101,7 @@ __global__ void ReluGradientCUDAKernel<half2>(
const float2 dy = __half22float2(dY[i]);
const float2 yy = __half22float2(Y[i]);
dX[i] =
- __floats2half2_rn(yy.x > 0.0f ? dy.x : 0.0f, yy.y > 0.0f ? dy.y : 0.0f);
+ __floats2half2_rn(yy.x > 0.0f ? float(dy.x) : 0.0f, yy.y > 0.0f ? float(dy.y) : 0.0f);
#endif
}
}
--
2.24.1