Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions GNNLux/src/layers/conv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,10 @@ end

function Base.show(io::IO, l::GATConv)
(in, ein), out = l.channel
print(io, "GATConv(", ein == 0 ? in : (in, ein), " => ", out ÷ l.heads)
print(io, "GATConv(", ein == 0 ? in : (in, ein), " => ", out)
l.σ == identity || print(io, ", ", l.σ)
l.heads == 1 || print(io, ", heads=", l.heads)
l.concat || print(io, ", concat=", l.concat)
print(io, ", negative_slope=", l.negative_slope)
print(io, ")")
end
Expand Down Expand Up @@ -1094,8 +1096,10 @@ end

function Base.show(io::IO, l::GATv2Conv)
(in, ein), out = l.channel
print(io, "GATv2Conv(", ein == 0 ? in : (in, ein), " => ", out ÷ l.heads)
print(io, "GATv2Conv(", ein == 0 ? in : (in, ein), " => ", out)
l.σ == identity || print(io, ", ", l.σ)
l.heads == 1 || print(io, ", heads=", l.heads)
l.concat || print(io, ", concat=", l.concat)
print(io, ", negative_slope=", l.negative_slope)
print(io, ")")
end
Expand Down
26 changes: 26 additions & 0 deletions GNNLux/test/layers/conv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,32 @@
@test all(isone, ps.dense_e.weight)
end

@testitem "GATConv show" setup=[TestModuleLux] begin
using .TestModuleLux

@test sprint(show, GATConv(6 => 8)) ==
"GATConv(6 => 8, negative_slope=0.2)"
@test sprint(show, GATConv(6 => 8; heads = 2)) ==
"GATConv(6 => 8, heads=2, negative_slope=0.2)"
@test sprint(show, GATConv(6 => 8; concat = false)) ==
"GATConv(6 => 8, concat=false, negative_slope=0.2)"
@test sprint(show, GATConv(6 => 8; heads = 2, concat = false)) ==
"GATConv(6 => 8, heads=2, concat=false, negative_slope=0.2)"
end

@testitem "GATv2Conv show" setup=[TestModuleLux] begin
using .TestModuleLux

@test sprint(show, GATv2Conv(6 => 8)) ==
"GATv2Conv(6 => 8, negative_slope=0.2)"
@test sprint(show, GATv2Conv(6 => 8; heads = 2)) ==
"GATv2Conv(6 => 8, heads=2, negative_slope=0.2)"
@test sprint(show, GATv2Conv(6 => 8; concat = false)) ==
"GATv2Conv(6 => 8, concat=false, negative_slope=0.2)"
@test sprint(show, GATv2Conv(6 => 8; heads = 2, concat = false)) ==
"GATv2Conv(6 => 8, heads=2, concat=false, negative_slope=0.2)"
end

@testitem "layers/conv" setup=[TestModuleLux] begin
using .TestModuleLux

Expand Down
8 changes: 6 additions & 2 deletions GraphNeuralNetworks/src/layers/conv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,10 @@ end

function Base.show(io::IO, l::GATConv)
(in, ein), out = l.channel
print(io, "GATConv(", ein == 0 ? in : (in, ein), " => ", out ÷ l.heads)
print(io, "GATConv(", ein == 0 ? in : (in, ein), " => ", out)
l.σ == identity || print(io, ", ", l.σ)
l.heads == 1 || print(io, ", heads=", l.heads)
l.concat || print(io, ", concat=", l.concat)
print(io, ", negative_slope=", l.negative_slope)
print(io, ")")
end
Expand Down Expand Up @@ -467,8 +469,10 @@ end

function Base.show(io::IO, l::GATv2Conv)
(in, ein), out = l.channel
print(io, "GATv2Conv(", ein == 0 ? in : (in, ein), " => ", out ÷ l.heads)
print(io, "GATv2Conv(", ein == 0 ? in : (in, ein), " => ", out)
l.σ == identity || print(io, ", ", l.σ)
l.heads == 1 || print(io, ", heads=", l.heads)
l.concat || print(io, ", concat=", l.concat)
print(io, ", negative_slope=", l.negative_slope)
print(io, ")")
end
Expand Down
26 changes: 26 additions & 0 deletions GraphNeuralNetworks/test/layers/conv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,19 @@ end
end


@testitem "GATConv show" setup=[TestModule] begin
using .TestModule

@test sprint(show, GATConv(6 => 8)) ==
"GATConv(6 => 8, negative_slope=0.2)"
@test sprint(show, GATConv(6 => 8; heads = 2)) ==
"GATConv(6 => 8, heads=2, negative_slope=0.2)"
@test sprint(show, GATConv(6 => 8; concat = false)) ==
"GATConv(6 => 8, concat=false, negative_slope=0.2)"
@test sprint(show, GATConv(6 => 8; heads = 2, concat = false)) ==
"GATConv(6 => 8, heads=2, concat=false, negative_slope=0.2)"
end

@testitem "GATConv" setup=[TolSnippet, TestModule] begin
using .TestModule
for heads in (1, 2), concat in (true, false)
Expand Down Expand Up @@ -219,6 +232,19 @@ end
end
end

@testitem "GATv2Conv show" setup=[TestModule] begin
using .TestModule

@test sprint(show, GATv2Conv(6 => 8)) ==
"GATv2Conv(6 => 8, negative_slope=0.2)"
@test sprint(show, GATv2Conv(6 => 8; heads = 2)) ==
"GATv2Conv(6 => 8, heads=2, negative_slope=0.2)"
@test sprint(show, GATv2Conv(6 => 8; concat = false)) ==
"GATv2Conv(6 => 8, concat=false, negative_slope=0.2)"
@test sprint(show, GATv2Conv(6 => 8; heads = 2, concat = false)) ==
"GATv2Conv(6 => 8, heads=2, concat=false, negative_slope=0.2)"
end

@testitem "GATv2Conv" setup=[TolSnippet, TestModule] begin
using .TestModule
for heads in (1, 2), concat in (true, false)
Expand Down