aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-03-17 21:45:45 -0700
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2016-03-17 21:45:45 -0700
commit7b98de1f15dd9f686e67b88c78708d4adc15adf5 (patch)
treeb331ac66eedd3c5e2ba8d48e655388f0718da27a
parent95b8961a9b2ac3e063ba9ddb7ac8515e24cae6c2 (diff)
Implemented some of the missing type casting for half floats
-rw-r--r--Eigen/src/Core/arch/CUDA/TypeCasting.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/Eigen/src/Core/arch/CUDA/TypeCasting.h b/Eigen/src/Core/arch/CUDA/TypeCasting.h
index b59b42170..10610ac44 100644
--- a/Eigen/src/Core/arch/CUDA/TypeCasting.h
+++ b/Eigen/src/Core/arch/CUDA/TypeCasting.h
@@ -24,8 +24,7 @@ struct scalar_cast_op<float, half> {
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300
return __float2half(a);
#else
- assert(false && "tbd");
- return half();
+ return half(a);
#endif
}
};
@@ -43,8 +42,7 @@ struct scalar_cast_op<int, half> {
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300
return __float2half(static_cast<float>(a));
#else
- assert(false && "tbd");
- return half();
+ return half(static_cast<float>(a));
#endif
}
};
@@ -62,8 +60,7 @@ struct scalar_cast_op<half, float> {
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300
return __half2float(a);
#else
- assert(false && "tbd");
- return 0.0f;
+ return static_cast<float>(a);
#endif
}
};