Skip to content

Commit 93bdbc6

Browse files
committed
Vulkan: fix NaN in tanh.comp
1 parent 43ed389 commit 93bdbc6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ggml/src/ggml-vulkan/vulkan-shaders/tanh.comp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ void main() {
1616
if (i >= p.KX) {
1717
return;
1818
}
19-
20-
data_d[i] = D_TYPE(tanh(data_a[i]));
19+
float th = tanh(data_a[i]);
20+
data_d[i] = D_TYPE(th==th ? th : sign(data_a[i]));
2121
}

0 commit comments

Comments
 (0)