Fix out-of-bounds default value in logsumexp/softmax (#2213)

This commit is contained in:
Cheng
2025-05-21 23:25:16 +09:00
committed by GitHub
parent 7774b87cbd
commit 79071bfba4
3 changed files with 7 additions and 4 deletions

View File

@@ -1036,6 +1036,9 @@ TEST_CASE("test reduction ops") {
x = array({-inf, -inf});
CHECK_EQ(logsumexp(x).item<float>(), -inf);
x = repeat(array(-inf), 5000);
CHECK_EQ(logsumexp(x).item<float>(), -inf);
x = array({0.0f, -inf});
CHECK_EQ(logsumexp(x).item<float>(), 0.0f);