Closed svilupp closed 1 year ago
First of all, thank you for this package! It's amazing - I've been exploring it for some use cases at work!
I think I noticed a bug in HeteroGraphConv when one adds two destination nodes of the same name.
Expectation: Two destination nodes of the same type in HeteroGraphConv should be aggregated by the aggr kwarg
aggr
Behavior: When two destination nodes clash (same node type), an error is thrown (see MWE):
ERROR: duplicate field name in NamedTuple: "movie" is not unique Stacktrace: [1] NamedTuple @ Core ./boot.jl:620 [inlined] [2] (NamedTuple{(:movie, :movie)})(itr::Vector{Matrix{Float32}}) @ Base ./namedtuple.jl:149 [3] _reduceby_node_t(aggr::Function, outs::Vector{Matrix{Float32}}, ntypes::Vector{Symbol}) @ GraphNeuralNetworks ~/Documents/GitHub/GraphNeuralNetworks.jl/src/layers/heteroconv.jl:80 [4] (::HeteroGraphConv)(g::GNNHeteroGraph{Tuple{…}}, x::@NamedTuple{user::Matrix{…}, movie::Matrix{…}, actor::Matrix{…}}) @ GraphNeuralNetworks ~/Documents/GitHub/GraphNeuralNetworks.jl/src/layers/heteroconv.jl:65
ERROR: duplicate field name in NamedTuple: "movie" is not unique
Stacktrace: [1] NamedTuple @ Core ./boot.jl:620 [inlined] [2] (NamedTuple{(:movie, :movie)})(itr::Vector{Matrix{Float32}}) @ Base ./namedtuple.jl:149 [3] _reduceby_node_t(aggr::Function, outs::Vector{Matrix{Float32}}, ntypes::Vector{Symbol}) @ GraphNeuralNetworks ~/Documents/GitHub/GraphNeuralNetworks.jl/src/layers/heteroconv.jl:80 [4] (::HeteroGraphConv)(g::GNNHeteroGraph{Tuple{…}}, x::@NamedTuple{user::Matrix{…}, movie::Matrix{…}, actor::Matrix{…}}) @ GraphNeuralNetworks ~/Documents/GitHub/GraphNeuralNetworks.jl/src/layers/heteroconv.jl:65
Suspected root cause: This line. _reduceby_node_t assumes ntypes to be a unique list of destination node types, but it is not.
_reduceby_node_t
ntypes
MWE:
using GraphNeuralNetworks g = GNNHeteroGraph((:user, :rate, :movie) => ([1,1,2,3], [7,13,5,7]);num_nodes=Dict(:user=>10,:movie=>15)) g = add_edges(g, (:actor, :like, :movie) => ([1,2,3,3,3], [3,5,1,9,4])) x = (user = rand(Float32, 64, 10), movie = rand(Float32, 64, 15),actor=rand(Float32, 64, 3)); layer = HeteroGraphConv((:user, :rate, :movie) => GraphConv(64 => 32), (:actor, :like, :movie) => GraphConv(64 => 32)); y = layer(g, x); # ERROR: duplicate field name in NamedTuple: "movie" is not unique
Versioninfo:
julia> versioninfo() Julia Version 1.10.0-beta2 Commit a468aa198d0 (2023-08-17 06:27 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: macOS (arm64-apple-darwin22.4.0) CPU: 8 × Apple M1 Pro WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1) Threads: 8 on 6 virtual cores Environment: JULIA_EDITOR = code JULIA_NUM_THREADS = 8
Package version: 0.6.11 (current main branch)
First of all, thank you for this package! It's amazing - I've been exploring it for some use cases at work!
I think I noticed a bug in HeteroGraphConv when one adds two destination nodes of the same name.
Expectation: Two destination nodes of the same type in HeteroGraphConv should be aggregated by the
aggr
kwargBehavior: When two destination nodes clash (same node type), an error is thrown (see MWE):
Suspected root cause: This line.
_reduceby_node_t
assumesntypes
to be a unique list of destination node types, but it is not.MWE:
Versioninfo:
Package version: 0.6.11 (current main branch)