Skip to content

UndefVarError: ones_like not defined in GNNLib in SGConv example #599

@MaHaWo

Description

@MaHaWo

Running the example code given in the documentation here
results in the error described in the title:

# test.jl

using GraphNeuralNetworks

# create data
s = [1,1,2,3]
t = [2,3,1,1]
g = GNNGraph(s, t)
x = randn(Float32, 3, g.num_nodes)

# create layer
l = SGConv(3 => 5; add_self_loops = true)

# forward pass
y = l(g, x)       # size:  5 × num_nodes

# convolution with edge weights
w = [1.1, 0.1, 2.3, 0.5]
y = l(g, x, w) # ERROR HERE

# Edge weights can also be embedded in the graph.
g = GNNGraph(s, t, w)
l = SGConv(3 => 5, add_self_loops = true, use_edge_weight=true) 
y = l(g, x) # same as l(g, x, w) 

Error message:

ERROR: UndefVarError: `ones_like` not defined in `GNNlib`
Suggestion: check for spelling errors or missing imports.
Hint: a global variable of this name also exists in MLUtils.
Stacktrace:
 [1] sg_conv(l::SGConv{Matrix{…}, Vector{…}}, g::GNNGraph{Tuple{…}}, x::Matrix{Float32}, edge_weight::Vector{Float64})
   @ GNNlib ~/.julia/packages/GNNlib/ynkEA/src/layers/conv.jl:515
 [2] (::SGConv{Matrix{…}, Vector{…}})(g::GNNGraph{Tuple{…}}, x::Matrix{Float32}, edge_weight::Vector{Float64})
   @ GraphNeuralNetworks ~/.julia/packages/GraphNeuralNetworks/3k4Ik/src/layers/conv.jl:1212
 [3] top-level scope
   @ ~/Development/geomentric_deeplearning_experiments/geometric.jl/src/test.jl:20

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