Skip to content

Commit 9ba9f5f

Browse files
cleanup
1 parent efb146a commit 9ba9f5f

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/GNNGraphs/utils.jl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,17 @@ function normalize_graphdata(data::NamedTuple; default_name, n, duplicate_if_nee
7777
# unsqz_first(v) = v
7878
# data = map(unsqz_first, data)
7979

80-
sz = map(x -> x isa AbstractArray ? size(x)[end] : 0, data)
81-
8280
if duplicate_if_needed
83-
# Used to copy edge features on reverse edges
84-
@assert all(s -> s == 0 || s == n || s == n÷2, sz) "Wrong size in last dimension for feature array."
85-
8681
function duplicate(v)
87-
if size(v)[end] == n÷2
82+
if v isa AbstractArray && size(v)[end] == n÷2
8883
v = cat(v, v, dims=ndims(v))
8984
end
9085
v
9186
end
9287
data = map(duplicate, data)
9388
end
9489

95-
@assert all(x -> x == 0 || x == n, sz) "Wrong size in last dimension for feature array."
90+
@assert all(x -> x isa AbstractArray ? size(x)[end] == n : true, data) "Wrong size in last dimension for feature array."
9691

9792
return data
9893
end

0 commit comments

Comments
 (0)