Skip to content

Commit

Permalink
Merge #926
Browse files Browse the repository at this point in the history
926: Fix binarycrossentropy on CuArrays r=MikeInnes a=janEbert

Ref #889.

Co-authored-by: janEbert <janpublicebert@posteo.net>
  • Loading branch information
bors[bot] and janEbert authored Nov 8, 2019
2 parents 9d05afa + 3dceef4 commit 4f42fb2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/layers/stateless.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using CuArrays
using NNlib: logsoftmax, logσ

# Cost functions
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4f42fb2

Please sign in to comment.