1013: Adapt to GPUArrays/CuArrays changes r=dhairyagandhi96 a=maleadt

Changes in response to a29df67184 and https://github.com/JuliaGPU/CuArrays.jl/pull/576. I suppose the next CuArrays release will need to be breaking because of this.

Maybe the `crossentropy` signature needs to be adjusted to support integer vectors, but I'll leave that decision up to Flux developers. This at least is the quick fix to get the tests passing again.

Co-authored-by: Tim Besard <tim.besard@gmail.com>
This commit is contained in:
bors[bot] 2020-02-03 16:29:48 +00:00 committed by GitHub
commit 60043fa2aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@ cm = gpu(m)
@test all(p isa CuArray for p in params(cm)) @test all(p isa CuArray for p in params(cm))
@test cm(gpu(rand(10, 10))) isa CuArray{Float32,2} @test cm(gpu(rand(10, 10))) isa CuArray{Float32,2}
x = [1,2,3] x = [1.,2.,3.]
cx = gpu(x) cx = gpu(x)
@test Flux.crossentropy(x,x) Flux.crossentropy(cx,cx) @test Flux.crossentropy(x,x) Flux.crossentropy(cx,cx)
@test Flux.crossentropy(x,x, weight=1.0) Flux.crossentropy(cx,cx, weight=1.0) @test Flux.crossentropy(x,x, weight=1.0) Flux.crossentropy(cx,cx, weight=1.0)
@ -33,8 +33,8 @@ cx = gpu(x)
x = [-1.1491, 0.8619, 0.3127] x = [-1.1491, 0.8619, 0.3127]
y = [1, 1, 0.] y = [1, 1, 0.]
@test Flux.binarycrossentropy.(σ.(x),y) Flux.binarycrossentropy.(cu(σ.(x)),cu(y)) @test Flux.binarycrossentropy.(σ.(x),y) Array(Flux.binarycrossentropy.(cu(σ.(x)),cu(y)))
@test Flux.logitbinarycrossentropy.(x,y) Flux.logitbinarycrossentropy.(cu(x),cu(y)) @test Flux.logitbinarycrossentropy.(x,y) Array(Flux.logitbinarycrossentropy.(cu(x),cu(y)))
xs = rand(5, 5) xs = rand(5, 5)
ys = Flux.onehotbatch(1:5,1:5) ys = Flux.onehotbatch(1:5,1:5)