Skip to content
Snippets Groups Projects
Commit 0579d407 authored by Olivier Antoni's avatar Olivier Antoni Committed by Olivier BICHLER
Browse files

Improve Sigmoid

parent b5d1330b
No related branches found
No related tags found
2 merge requests!73version 0.2.3,!69Improve Sigmoid
Pipeline #48732 passed
......@@ -27,7 +27,11 @@ void SigmoidImpl_cpu_forward_kernel(std::size_t inputLenght,
//#pragma omp parallel for if (inputLenght > 1024)
for (std::size_t i = 0; i < inputLenght; ++i) {
output[i] = O(1) / (O(1) + std::exp(-input[i]));
if (input[i] > I(0)) {
output[i] = O(1) / (O(1) + std::exp(-input[i]));
} else {
output[i] = std::exp(input[i]) / (O(1) + std::exp(input[i]));
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment