Skip to content

Commit 06d7014

Browse files
authored
Vulkan: fix NaN in tanh.comp with AMD proprietary driver on Windows (ggml-org#10723)
* Vulkan: fix NaN in tanh.comp * Faster NaN-free tanh
1 parent 43ed389 commit 06d7014

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@ void main() {
1616
if (i >= p.KX) {
1717
return;
1818
}
19-
20-
data_d[i] = D_TYPE(tanh(data_a[i]));
19+
data_d[i] = D_TYPE(1. - 2. / (exp(2.*data_a[i]) + 1.));
2120
}

0 commit comments

Comments
 (0)