CarloLucibello / GraphNeuralNetworks.jl

Graph Neural Networks in Julia
https://carlolucibello.github.io/GraphNeuralNetworks.jl/dev/
MIT License
214 stars 47 forks source link

need more informative error for dimension mismatch #283

Closed CarloLucibello closed 1 year ago

CarloLucibello commented 1 year ago
julia> g = rand_graph(3, 2)
GNNGraph:
  num_nodes: 3
  num_edges: 2

julia> g.ndata.x = rand(1, 2)
ERROR: AssertionError: expected (numobs(x) == getn(ds)) but got 2 != 3
Stacktrace:
 [1] setproperty!(ds::DataStore, s::Symbol, x::Matrix{Float64})
   @ GraphNeuralNetworks.GNNGraphs ~/.julia/packages/GraphNeuralNetworks/xxXa4/src/GNNGraphs/datastore.jl:112
 [2] top-level scope
   @ REPL[6]:1
aurorarossi commented 1 year ago
julia> g.ndata.x = rand(1,2)
ERROR: DimensionMismatch: expected 3 object features but got 2.
Stacktrace:
 [1] setproperty!(ds::DataStore, s::Symbol, x::Matrix{Float64})
   @ GraphNeuralNetworks.GNNGraphs ~/GraphNeuralNetworks.jl/src/GNNGraphs/datastore.jl:112
 [2] top-level scope
   @ REPL[10]:1

You mean something like this using the DimensionMismatch error? or a longer description?

CarloLucibello commented 1 year ago

yes, something like that would be fine

CarloLucibello commented 1 year ago

Closed in #287