Skip to content

Commit 6fdcc51

Browse files
authored
fix: Empty edge handling in softmax_edge_neighbors (#636)
* fix: Set init in `softmax_edge_neighbors` * fix: Dimension consistency
1 parent 1d0edf8 commit 6fdcc51

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

GNNlib/src/utils.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ function softmax_edge_neighbors(g::AbstractGNNGraph, e)
9090
@assert size(e)[end] == g.num_edges
9191
end
9292
s, t = edge_index(g)
93+
if isempty(t)
94+
return zeros_like(e, eltype(e), (size(e)[1:end-1]..., 0))
95+
end
9396
max_ = gather(scatter(max, e, t), t)
9497
num = exp.(e .- max_)
9598
den = gather(scatter(+, num, t), t)

0 commit comments

Comments
 (0)