Add test for CUDA binarycrossentropy

This commit is contained in:
janEbert 2019-11-08 17:28:38 +01:00
parent 3dceef427f
commit a00d8d94ec
1 changed files with 4 additions and 0 deletions

View File

@ -31,6 +31,10 @@ cx = gpu(x)
@test Flux.crossentropy(x,x, weight=1.0) Flux.crossentropy(cx,cx, weight=1.0)
@test Flux.crossentropy(x,x, weight=[1.0;2.0;3.0]) Flux.crossentropy(cx,cx, weight=cu([1.0;2.0;3.0]))
x = σ.([-1.1491, 0.8619, 0.3127])
y = [1, 1, 0.]
@test Flux.binarycrossentropy.(x,y) Flux.binarycrossentropy.(cu(x),cu(y))
xs = rand(5, 5)
ys = Flux.onehotbatch(1:5,1:5)
@test collect(cu(xs) .+ cu(ys)) collect(xs .+ ys)