FluxML / GeometricFlux.jl

Geometric Deep Learning for Flux
https://fluxml.ai/GeometricFlux.jl/stable/
MIT License
348 stars 30 forks source link

FeaturedGraph cannot be moved to gpu #202

Closed CarloLucibello closed 3 years ago

CarloLucibello commented 3 years ago
julia> using GeometricFlux, Flux

julia> fg = FeaturedGraph([0 1 0; 1 0 1; 1 0 0])
FeaturedGraph(
    Directed graph with (#V=3, #E=4) in adjacency matrix <Matrix{Int64}>,
)

julia> fg.graph
3×3 Matrix{Int64}:
 0  1  0
 1  0  1
 1  0  0

julia> fg =FeaturedGraph([0 1 0; 1 0 1; 1 0 0]) |> gpu
FeaturedGraph(
    Directed graph with (#V=3, #E=4) in adjacency matrix <Matrix{Int64}>,
)

julia> fg.graph
3×3 Matrix{Int64}:
 0  1  0
 1  0  1
 1  0  0

This is a quick fix, we just have to functorize it

julia> Flux.@functor FeaturedGraph

julia> fg =FeaturedGraph([0 1 0; 1 0 1; 1 0 0]) |> gpu
FeaturedGraph(
    Directed graph with (#V=3, #E=4) in adjacency matrix <CUDA.CuArray{Int64, 2}>,
)

julia> fg.graph
3×3 CUDA.CuArray{Int64, 2}:
 0  1  0
 1  0  1
 1  0  0
yuehhua commented 3 years ago

This issue should move to GraphSignals.jl. The definition of FeaturedGraph is not here.

CarloLucibello commented 3 years ago

done https://github.com/yuehhua/GraphSignals.jl/issues/47