Skip to content

Wrong implementation DConv #592

@aurorarossi

Description

@aurorarossi

Code:

function d_conv(l, g::GNNGraph, x::AbstractMatrix)
    #A = adjacency_matrix(g, weighted = true)
    s, t = edge_index(g)
    gt = GNNGraph(t, s, get_edge_weight(g))
    deg_out = degree(g; dir = :out)
    deg_in = degree(g; dir = :in)
    deg_out = Diagonal(deg_out)
    deg_in = Diagonal(deg_in)
    
    h = l.weights[1,1,:,:] * x .+ l.weights[2,1,:,:] * x

    T0 = x
    if l.k > 1
        # T1_in = T0 * deg_in * A'
        #T1_out = T0 * deg_out' * A
        T1_out = propagate(w_mul_xj, g, +; xj = T0*deg_out')
        T1_in = propagate(w_mul_xj, gt, +; xj = T0*deg_in)
        h = h .+ l.weights[1,2,:,:] * T1_in .+ l.weights[2,2,:,:] * T1_out
    end
    for i in 2:l.k
        T2_in = propagate(w_mul_xj, gt, +; xj = T1_in*deg_in)
        T2_in = 2 * T2_in - T0
        T2_out =  propagate(w_mul_xj, g ,+; xj = T1_out*deg_out')
        T2_out = 2 * T2_out - T0
        h = h .+ l.weights[1,i,:,:] * T2_in .+ l.weights[2,i,:,:] * T2_out
        T1_in = T2_in
        T1_out = T2_out
    end
    return h .+ l.bias
end

Appendix of the paper:

Image

hence the line T2_in = 2 * T2_in - T0 is not correct.
I will fix this soon.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingflux

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions