mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-30 15:54:13 +08:00
Implemented some of the missing type casting for half floats
This commit is contained in:
parent
95b8961a9b
commit
7b98de1f15
@ -24,8 +24,7 @@ struct scalar_cast_op<float, half> {
|
|||||||
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300
|
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300
|
||||||
return __float2half(a);
|
return __float2half(a);
|
||||||
#else
|
#else
|
||||||
assert(false && "tbd");
|
return half(a);
|
||||||
return half();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -43,8 +42,7 @@ struct scalar_cast_op<int, half> {
|
|||||||
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300
|
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300
|
||||||
return __float2half(static_cast<float>(a));
|
return __float2half(static_cast<float>(a));
|
||||||
#else
|
#else
|
||||||
assert(false && "tbd");
|
return half(static_cast<float>(a));
|
||||||
return half();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -62,8 +60,7 @@ struct scalar_cast_op<half, float> {
|
|||||||
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300
|
#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300
|
||||||
return __half2float(a);
|
return __half2float(a);
|
||||||
#else
|
#else
|
||||||
assert(false && "tbd");
|
return static_cast<float>(a);
|
||||||
return 0.0f;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user