Fix binarycrossentropy on CuArrays

This commit is contained in:
janEbert 2019-11-08 16:48:11 +01:00
parent 9d05afaccc
commit 3dceef427f

View File

@ -1,3 +1,4 @@
using CuArrays
using NNlib: logsoftmax, logσ
# Cost functions
@ -35,6 +36,9 @@ Return `-y*log(ŷ + ϵ) - (1-y)*log(1-ŷ + ϵ)`. The ϵ term provides numerica
"""
binarycrossentropy(, y; ϵ=eps()) = -y*log( + ϵ) - (1 - y)*log(1 - + ϵ)
# Re-definition to fix interaction with CuArrays.
CuArrays.@cufunc binarycrossentropy(, y; ϵ=eps()) = -y*log( + ϵ) - (1 - y)*log(1 - + ϵ)
"""
logitbinarycrossentropy(logŷ, y)