Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
CarloLucibello committed Jul 1, 2020
1 parent c1da4b5 commit b81552a
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions src/layers/stateless.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,44 +120,8 @@ function logitbce_loss(ŷ, y; agg=mean)
agg(@.((1-y)*- logσ(ŷ)))
end
# Re-definition to fix interaction with CuArrays.
<<<<<<< HEAD
CuArrays.@cufunc logitbinarycrossentropy(ŷ, y) = (1 - y)*ŷ - logσ(ŷ)

"""
normalise(x; dims=1, ϵ=1.0e-5))
Normalise `x` to mean 0 and standard deviation 1 across the dimensions given by `dims`.
Defaults to normalising over columns. Regularizes the standard deviation by `ϵ`.
```jldoctest
julia> a = reshape(collect(1:9), 3, 3)
3×3 Array{Int64,2}:
1 4 7
2 5 8
3 6 9
julia> Flux.normalise(a)
3×3 Array{Float64,2}:
-1.22473 -1.22473 -1.22473
0.0 0.0 0.0
1.22473 1.22473 1.22473
julia> Flux.normalise(a, dims=2)
3×3 Array{Float64,2}:
-1.22474 0.0 1.22474
-1.22474 0.0 1.22474
-1.22474 0.0 1.22474
```
"""
function normalise(x::AbstractArray; dims=1, ϵ=1.0f-5)
μ′ = mean(x, dims = dims)
σ′ = std(x, dims = dims, mean = μ′, corrected=false)
return (x .- μ′) ./ (σ′ .+ ϵ)
end
=======
# CuArrays.@cufunc logitbce_loss(ŷ, y) = (1 - y)*ŷ - logσ(ŷ)

>>>>>>> 210028b3... new loss interface

"""
kldivergence(ŷ, y; agg=mean)
Expand Down

0 comments on commit b81552a

Please sign in to comment.