We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
softmax_edge_neighbors
1 parent 1d0edf8 commit 355d352Copy full SHA for 355d352
1 file changed
GNNlib/src/utils.jl
@@ -90,6 +90,9 @@ function softmax_edge_neighbors(g::AbstractGNNGraph, e)
90
@assert size(e)[end] == g.num_edges
91
end
92
s, t = edge_index(g)
93
+ if isempty(t)
94
+ return zero(eltype(e))
95
+ end
96
max_ = gather(scatter(max, e, t), t)
97
num = exp.(e .- max_)
98
den = gather(scatter(+, num, t), t)
0 commit comments