Skip to content

Method error when training GCNConv with FeaturedGraph input #76

Closed
@tdfalc1

Description

@tdfalc1

I made the following modifications to the GCNConv layer example to incorporate FeaturedGraph input:

train_X_fg = GeometricFlux.FeaturedGraph(adj_mat, train_X)

model = Chain(GCNConv(num_features => hidden, relu),
              Dropout(0.5),
              GCNConv(hidden => target_catg),
              x -> softmax(x.nf[])) |> gpu

train_data = [(train_X_fg, train_y)]
@epochs epochs Flux.train!(loss, ps, train_data, opt, cb=throttle(evalcb, 10))

I get the following error:

ERROR: MethodError: no method matching (::GeometricFlux.var"#adjacency_matrix#76")(::FeaturedGraph{Array{Float32,2},SparseMatrixCSC{Float32,Int64},Array{Float64,2},Array{Float64,1}})
Closest candidates are:
  adjacency_matrix(::AbstractArray{T,2} where T) at /Users/thomasfalconer/.julia/packages/GeometricFlux/k4atN/src/operations/linalg.jl:6
  adjacency_matrix(::AbstractArray{T,2} where T, ::DataType) at /Users/thomasfalconer/.julia/packages/GeometricFlux/k4atN/src/operations/linalg.jl:6
Stacktrace:
 [1] _pullback at /Users/thomasfalconer/.julia/packages/Zygote/iFibI/src/lib/grad.jl:8 [inlined]
 [2] GCNConv at /Users/thomasfalconer/.julia/packages/GeometricFlux/k4atN/src/layers/conv.jl:55 [inlined]
 [3] _pullback(::Zygote.Context, ::GCNConv{Float32,typeof(relu),FeaturedGraph{Array{Float64,2},Array{Float64,2},Array{Float64,2},Array{Float64,1}}}, ::FeaturedGraph{Array{Float32,2},SparseMatrixCSC{Float32,Int64},Array{Float64,2},Array{Float64,1}}) at /Users/thomasfalconer/.julia/packages/Zygote/iFibI/src/compiler/interface2.jl:0
 [4] applychain at /Users/thomasfalconer/.julia/packages/Flux/IjMZL/src/layers/basic.jl:36 [inlined]
 [5] _pullback(::Zygote.Context, ::typeof(Flux.applychain), ::Tuple{GCNConv{Float32,typeof(relu),FeaturedGraph{Array{Float64,2},Array{Float64,2},Array{Float64,2},Array{Float64,1}}},Dropout{Float64,Colon},GCNConv{Float32,typeof(identity),FeaturedGraph{Array{Float64,2},Array{Float64,2},Array{Float64,2},Array{Float64,1}}},var"#11#12"}, ::FeaturedGraph{Array{Float32,2},SparseMatrixCSC{Float32,Int64},Array{Float64,2},Array{Float64,1}}) at /Users/thomasfalconer/.julia/packages/Zygote/iFibI/src/compiler/interface2.jl:0
 [6] Chain at /Users/thomasfalconer/.julia/packages/Flux/IjMZL/src/layers/basic.jl:38 [inlined]
 [7] _pullback(::Zygote.Context, ::Chain{Tuple{GCNConv{Float32,typeof(relu),FeaturedGraph{Array{Float64,2},Array{Float64,2},Array{Float64,2},Array{Float64,1}}},Dropout{Float64,Colon},GCNConv{Float32,typeof(identity),FeaturedGraph{Array{Float64,2},Array{Float64,2},Array{Float64,2},Array{Float64,1}}},var"#11#12"}}, ::FeaturedGraph{Array{Float32,2},SparseMatrixCSC{Float32,Int64},Array{Float64,2},Array{Float64,1}}) at /Users/thomasfalconer/.julia/packages/Zygote/iFibI/src/compiler/interface2.jl:0
 [8] loss at ./REPL[42]:2 [inlined]
 [9] _pullback(::Zygote.Context, ::typeof(loss), ::FeaturedGraph{Array{Float32,2},SparseMatrixCSC{Float32,Int64},Array{Float64,2},Array{Float64,1}}, ::SparseMatrixCSC{Float32,Int64}) at /Users/thomasfalconer/.julia/packages/Zygote/iFibI/src/compiler/interface2.jl:0
 [10] adjoint at /Users/thomasfalconer/.julia/packages/Zygote/iFibI/src/lib/lib.jl:175 [inlined]
 [11] _pullback at /Users/thomasfalconer/.julia/packages/ZygoteRules/6nssF/src/adjoint.jl:47 [inlined]
 [12] #15 at /Users/thomasfalconer/.julia/packages/Flux/IjMZL/src/optimise/train.jl:83 [inlined]
 [13] _pullback(::Zygote.Context, ::Flux.Optimise.var"#15#21"{typeof(loss),Tuple{FeaturedGraph{Array{Float32,2},SparseMatrixCSC{Float32,Int64},Array{Float64,2},Array{Float64,1}},SparseMatrixCSC{Float32,Int64}}}) at /Users/thomasfalconer/.julia/packages/Zygote/iFibI/src/compiler/interface2.jl:0
 [14] pullback(::Function, ::Zygote.Params) at /Users/thomasfalconer/.julia/packages/Zygote/iFibI/src/compiler/interface.jl:172
 [15] gradient(::Function, ::Zygote.Params) at /Users/thomasfalconer/.julia/packages/Zygote/iFibI/src/compiler/interface.jl:53
 [16] macro expansion at /Users/thomasfalconer/.julia/packages/Flux/IjMZL/src/optimise/train.jl:82 [inlined]
 [17] macro expansion at /Users/thomasfalconer/.julia/packages/Juno/tLMZd/src/progress.jl:134 [inlined]
 [18] train!(::Function, ::Zygote.Params, ::Array{Tuple{FeaturedGraph{Array{Float32,2},SparseMatrixCSC{Float32,Int64},Array{Float64,2},Array{Float64,1}},SparseMatrixCSC{Float32,Int64}},1}, ::ADAM; cb::Flux.var"#throttled#26"{Flux.var"#throttled#22#27"{Bool,Bool,typeof(evalcb),Int64}}) at /Users/thomasfalconer/.julia/packages/Flux/IjMZL/src/optimise/train.jl:80
 [19] top-level scope at /Users/thomasfalconer/.julia/packages/Flux/IjMZL/src/optimise/train.jl:115
 [20] top-level scope at /Users/thomasfalconer/.julia/packages/Juno/tLMZd/src/progress.jl:134

Having trouble investigating the cause of this error @yuehhua

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions