Skip to content

Commit

Permalink
Test Tracker.jacobian on GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed May 30, 2019
1 parent 8ee6af1 commit 8255327
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/cuda/cuda.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ end
@test y[3,:] isa CuArray
end

@testset "Jacobian on GPU" begin
# https://github.com/FluxML/Tracker.jl/pull/33
@test collect(jacobian(identity, gpu([0.0, 0.0]))) == [1 0; 0 1]
@test collect(gradient(x -> sum(jacobian(y -> y .^ 2, x) .^ 2),
gpu([1.0, 2.0, 3.0]))) == [8.0, 16.0, 24.0]
end

if CuArrays.libcudnn != nothing
@info "Testing Flux/CUDNN"
include("cudnn.jl")
Expand Down

0 comments on commit 8255327

Please sign in to comment.