-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
15ea38b
commit b3d528b
Showing
11 changed files
with
524 additions
and
449 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
[deps] | ||
FiniteDifferences = "26cc04aa-876d-5657-8c51-4c34ba976000" | ||
Functors = "d9f16b24-f501-4c13-a1f2-28368ffc5196" | ||
GNNGraphs = "aed8fd31-079b-4b5a-b342-a13352159b8c" | ||
GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527" | ||
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
MLDataDevices = "7e8f7934-dd98-4c1a-8fe8-92b47a384d40" | ||
MLUtils = "f1d291b0-491e-4a28-83b9-f70985020b54" | ||
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" | ||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
Reexport = "189a3867-3050-52da-a836-e630ba90ab69" | ||
SimpleWeightedGraphs = "47aef6b3-ad0c-573a-a1e2-d07658019622" | ||
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" | ||
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
TestItems = "1c621080-faea-4a02-84b6-bbd5e436b8fe" | ||
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" | ||
|
||
[compat] | ||
GPUArraysCore = "0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
@testset "dict constructor" begin | ||
@testitem "dict constructor" setup=[GraphsTestModule] begin | ||
using .GraphsTestModule | ||
grad = gradient(1.) do x | ||
d = Dict([:x => x, :y => 5]...) | ||
return sum(d[:x].^2) | ||
end[1] | ||
|
||
@test grad == 2 | ||
|
||
## BROKEN Constructors | ||
# grad = gradient(1.) do x | ||
# d = Dict([(:x => x), (:y => 5)]) | ||
# return sum(d[:x].^2) | ||
# end[1] | ||
|
||
# @test grad == 2 | ||
grad = gradient(1.) do x | ||
d = Dict([:x => x, :y => 5]) | ||
return sum(d[:x].^2) | ||
end[1] | ||
|
||
@test grad == 2 | ||
|
||
# grad = gradient(1.) do x | ||
# d = Dict([(:x => x), (:y => 5)]) | ||
# return sum(d[:x].^2) | ||
# end[1] | ||
grad = gradient(1.) do x | ||
d = Dict(:x => x, :y => 5) | ||
return sum(d[:x].^2) | ||
end[1] | ||
|
||
# @test grad == 2 | ||
@test grad == 2 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
if TEST_GPU | ||
@testset "to_coo(dense) on gpu" begin | ||
get_st(A) = GNNGraphs.to_coo(A)[1][1:2] | ||
get_val(A) = GNNGraphs.to_coo(A)[1][3] | ||
@testitem "to_coo(dense) on gpu" setup=[GraphsTestModule] tags=[:gpu] begin | ||
using .GraphsTestModule | ||
get_st(A) = GNNGraphs.to_coo(A)[1][1:2] | ||
get_val(A) = GNNGraphs.to_coo(A)[1][3] | ||
gpu = gpu_device(force=true) | ||
A = gpu([0 2 2; 2.0 0 2; 2 2 0]) | ||
|
||
A = cu([0 2 2; 2.0 0 2; 2 2 0]) | ||
y = get_val(A) | ||
@test y isa AbstractVector{Float32} | ||
@test get_device(y) == get_device(A) | ||
@test Array(y) ≈ [2, 2, 2, 2, 2, 2] | ||
|
||
y = get_val(A) | ||
@test y isa CuVector{Float32} | ||
@test Array(y) ≈ [2, 2, 2, 2, 2, 2] | ||
s, t = get_st(A) | ||
@test s isa AbstractVector{<:Integer} | ||
@test t isa AbstractVector{<:Integer} | ||
@test get_device(s) == get_device(A) | ||
@test get_device(t) == get_device(A) | ||
@test Array(s) == [2, 3, 1, 3, 1, 2] | ||
@test Array(t) == [1, 1, 2, 2, 3, 3] | ||
|
||
s, t = get_st(A) | ||
@test s isa CuVector{<:Integer} | ||
@test t isa CuVector{<:Integer} | ||
@test Array(s) == [2, 3, 1, 3, 1, 2] | ||
@test Array(t) == [1, 1, 2, 2, 3, 3] | ||
|
||
@test gradient(A -> sum(get_val(A)), A)[1] isa CuMatrix{Float32} | ||
end | ||
grad = gradient(A -> sum(get_val(A)), A)[1] | ||
@test grad isa AbstractMatrix{Float32} | ||
@test get_device(grad) == get_device(A) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.