Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCNConv and SimpleWeightedGraphs #106

Closed
CarstenHUB opened this issue Oct 4, 2020 · 5 comments
Closed

GCNConv and SimpleWeightedGraphs #106

CarstenHUB opened this issue Oct 4, 2020 · 5 comments

Comments

@CarstenHUB
Copy link

Having trouble using a SimpleWeightedGraph as input for the GCNConv-layer.
My graph is an undirected simple Int64 graph with Float64 weights and calling adjacency_matrix() on this works fine.
But during training I get the error

InexactError: Int64(-1.0384249352874253)
Stacktrace:
[1] Int64 at .\float.jl:710 [inlined]
[2] _map_zeropres!(::Type{Int64}, ::SparseMatrixCSC{Int64,Int64}, ::SparseMatrixCSC{Float64,Int64}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\SparseArrays\src\higherorderfns.jl:246
[3] _noshapecheck_map(::Type{Int64}, ::SparseMatrixCSC{Float64,Int64}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\SparseArrays\src\higherorderfns.jl:165
[4] copy at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\SparseArrays\src\higherorderfns.jl:169 [inlined]
[5] materialize(::Base.Broadcast.Broadcasted{SparseArrays.HigherOrderFns.SparseMatStyle,Nothing,Type{Int64},Tuple{SparseMatrixCSC{Float64,Int64}}}) at .\broadcast.jl:837
[6] adjacency_matrix(::SimpleWeightedGraph{Int64,Float64}, ::DataType; dir::Symbol) at C:\Users\rcars.julia\packages\SimpleWeightedGraphs\IDzOp\src\overrides.jl:32
[7] adjacency_matrix at C:\Users\rcars.julia\packages\SimpleWeightedGraphs\IDzOp\src\overrides.jl:31 [inlined]
[8] adjacency_matrix at C:\Users\rcars.julia\packages\GraphSignals\dB9OV\src\linalg.jl:7 [inlined] (repeats 2 times)
[9] _pullback at C:\Users\rcars.julia\packages\Zygote\chgvX\src\lib\grad.jl:8 [inlined]

and I don't see why it tries to change the values to Int64.
Does anyone have an idea?

@yuehhua
Copy link
Member

yuehhua commented Nov 16, 2020

Sorry to be late. Could you update GeometricFlux and try that again?

@CarstenHUB
Copy link
Author

Unfortunately, I get the same error even after updating.

@yuehhua
Copy link
Member

yuehhua commented Dec 12, 2021

Should be resolved.

@yuehhua
Copy link
Member

yuehhua commented Apr 6, 2022

If you're still interested, you could try new version. If you have any questions just comment down.

@eahenle
Copy link

eahenle commented May 11, 2023

This error (or something like it) seems to be present in the most recent version (0.13.10).

Given graphs::Vector{Metagraph}:

fgs = [
	FeaturedGraph(
		SimpleGraph(g); 
		nf=[get_prop(g, v, :label) for v in vertices(g)]',
		ef=[get_prop(g, e, :label) for e in edges(g)]'
	)
	for g in graphs
]

GCNConv(1 => 10, relu)(fgs[1]) # ❌ InexactError

Casting the node features to an actual matrix solves the problem:

fgs = [
	FeaturedGraph(
		SimpleGraph(g); 
		nf=Float32.([get_prop(g, v, :label) for v in vertices(g)]'),
		ef=[get_prop(g, e, :label) for e in edges(g)]'
	)
	for g in graphs
]

GCNConv(1 => 10, relu)(fgs[1]) # ✔️ 

@yuehhua yuehhua closed this as completed Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants