Răsfoiți Sursa

Vulkan: fix NaN in tanh.comp with AMD proprietary driver on Windows (#10723)

* Vulkan: fix NaN in tanh.comp

* Faster NaN-free tanh
stduhpf 1 an în urmă
părinte
comite
06d70147e6
1 a modificat fișierele cu 1 adăugiri și 2 ștergeri
  1. 1 2
      ggml/src/ggml-vulkan/vulkan-shaders/tanh.comp

+ 1 - 2
ggml/src/ggml-vulkan/vulkan-shaders/tanh.comp

@@ -16,6 +16,5 @@ void main() {
     if (i >= p.KX) {
         return;
     }
-
-    data_d[i] = D_TYPE(tanh(data_a[i]));
+    data_d[i] = D_TYPE(1. - 2. / (exp(2.*data_a[i]) + 1.));
 }