diff options
-rw-r--r-- | nerv/lib/matrix/generic/cukernel.cu | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/nerv/lib/matrix/generic/cukernel.cu b/nerv/lib/matrix/generic/cukernel.cu index c82041f..1a20b4f 100644 --- a/nerv/lib/matrix/generic/cukernel.cu +++ b/nerv/lib/matrix/generic/cukernel.cu @@ -60,7 +60,8 @@ __global__ void cudak_(tanh)(const MATRIX_ELEM *a, MATRIX_ELEM *b, long idx; if (i >= nrow || j >= ncol) return; idx = j + i * stride; - b[idx] = (exp(a[idx]) - exp(-a[idx])) / (exp(a[idx]) + exp(-a[idx])); + //b[idx] = (exp(a[idx]) - exp(-a[idx])) / (exp(a[idx]) + exp(-a[idx])); //could cause nan + b[idx] = tanh(a[idx]); } __global__ void cudak_(tanh_grad)(const MATRIX_ELEM *output, |