This commit is contained in:
Awni Hannun
2025-08-21 06:46:01 -07:00
committed by GitHub
parent 0c5fc63a36
commit e843c4d8d5
4 changed files with 24 additions and 3 deletions

View File

@@ -204,6 +204,10 @@ struct Power {
__device__ T operator()(T base, T exp) {
if constexpr (cuda::std::is_integral_v<T>) {
T res = 1;
// Raising an integer to a negative power is undefined
if (exp < 0) {
return 0;
}
while (exp) {
if (exp & 1) {
res *= base;