Skip to content

Commit 203e859

Browse files
committed
Avoid degenerate all-zero input in logsumexp test
The prior test seeded x = [0.0, 0.0, 0.0] and relied on logsumexp(x) == log(3). Locally that worked, but on GitHub's macos-14 runner the MLX kernel threw a non-std C++ exception during eval — fine's boundary caught it as the generic "unknown exception thrown within NIF". Most likely an MLX Metal-kernel edge case on the all-equal input path under that runner's virtualised Metal stack. Switch to [1.0, 2.0, 3.0] with the analytically-computed expected so the test exercises the non-degenerate code path that matters for real workloads.
1 parent 1b6c2e3 commit 203e859

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

test/emily/native_test.exs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,9 @@ defmodule Emily.NativeTest do
354354
end
355355

356356
test "logsumexp" do
357-
x = f32([0.0, 0.0, 0.0], [3])
358-
assert_close(to_f32_list(Native.logsumexp(x, [0], false)), [:math.log(3.0)])
357+
x = f32([1.0, 2.0, 3.0], [3])
358+
expected = :math.log(:math.exp(1.0) + :math.exp(2.0) + :math.exp(3.0))
359+
assert_close(to_f32_list(Native.logsumexp(x, [0], false)), [expected])
359360
end
360361

361362
test "argmax / argmin" do

0 commit comments

Comments
 (0)