Skip to content

Commit f8d26a3

Browse files
author
Sergio Sánchez Ramírez
committed
Disable numerical tests
due to circular dependency
1 parent 4e70f3c commit f8d26a3

File tree

4 files changed

+100
-59
lines changed

4 files changed

+100
-59
lines changed

test/EinExpr_test.jl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@
4747
tensor = EinExpr([:i, :j])
4848
expr = EinExpr([:i], [tensor])
4949

50-
@test all(splat(==)), zip(expr.head, [:i])
50+
@test all(splat(==), zip(expr.head, [:i]))
5151
@test expr.args == [tensor]
5252

53-
@test all(splat(==)), zip(head(expr), [:i])
54-
@test all(splat(==)), zip(inds(expr), [:i, :j])
53+
@test all(splat(==), zip(head(expr), [:i]))
54+
@test all(splat(==), zip(inds(expr), [:i, :j]))
5555

5656
@test isempty(hyperinds(expr))
5757
@test suminds(expr) == [:j]
@@ -68,11 +68,11 @@
6868
tensor = EinExpr([:i, :i])
6969
expr = EinExpr([:i], [tensor])
7070

71-
@test all(splat(==)), zip(expr.head, [:i])
71+
@test all(splat(==), zip(expr.head, [:i]))
7272
@test expr.args == [tensor]
7373

74-
@test all(splat(==)), zip(head(expr), [:i])
75-
@test all(splat(==)), zip(inds(expr), head(expr))
74+
@test all(splat(==), zip(head(expr), [:i]))
75+
@test all(splat(==), zip(inds(expr), head(expr)))
7676

7777
@test isempty(hyperinds(expr))
7878
@test isempty(suminds(expr))
@@ -91,7 +91,7 @@
9191
@test expr.args == [tensor]
9292

9393
@test isempty(head(expr))
94-
@test all(splat(==)), zip(inds(expr), [:i])
94+
@test all(splat(==), zip(inds(expr), [:i]))
9595

9696
@test isempty(hyperinds(expr))
9797
@test suminds(expr) == [:i]
@@ -106,11 +106,11 @@
106106
tensors = [EinExpr([:i, :j]), EinExpr([:k, :l])]
107107
expr = EinExpr([:i, :j, :k, :l], tensors)
108108

109-
@test all(splat(==)), zip(expr.head, [:i, :j, :k, :l])
109+
@test all(splat(==), zip(expr.head, [:i, :j, :k, :l]))
110110
@test expr.args == tensors
111111

112-
@test all(splat(==)), zip(head(expr), mapreduce(collect inds, vcat, tensors))
113-
@test all(splat(==)), zip(inds(expr), head(expr))
112+
@test all(splat(==), zip(head(expr), mapreduce(collect inds, vcat, tensors)))
113+
@test all(splat(==), zip(inds(expr), head(expr)))
114114
@test ndims(expr) == 4
115115

116116
@test isempty(hyperinds(expr))
@@ -135,7 +135,7 @@
135135
@test expr.args == tensors
136136

137137
@test isempty(head(expr))
138-
@test all(splat(==)), zip(inds(expr), [:i])
138+
@test all(splat(==), zip(inds(expr), [:i]))
139139
@test ndims(expr) == 0
140140

141141
@test isempty(hyperinds(expr))
@@ -154,7 +154,7 @@
154154
@test expr.args == tensors
155155

156156
@test isempty(head(expr))
157-
@test all(splat(==)), zip(inds(expr), [:i, :j])
157+
@test all(splat(==), zip(inds(expr), [:i, :j]))
158158
@test ndims(expr) == 0
159159

160160
@test isempty(hyperinds(expr))
@@ -172,11 +172,11 @@
172172
tensors = [EinExpr([:i, :k]), EinExpr([:k, :j])]
173173
expr = EinExpr([:i, :j], tensors)
174174

175-
@test all(splat(==)), zip(expr.head, [:i, :j])
175+
@test all(splat(==), zip(expr.head, [:i, :j]))
176176
@test expr.args == tensors
177177

178-
@test all(splat(==)), zip(head(expr), [:i, :j])
179-
@test all(splat(==)), zip(inds(expr), [:i, :k, :j])
178+
@test all(splat(==), zip(head(expr), [:i, :j]))
179+
@test all(splat(==), zip(inds(expr), [:i, :k, :j]))
180180
@test ndims(expr) == 2
181181

182182
@test isempty(hyperinds(expr))
@@ -217,7 +217,7 @@
217217
tensors = [EinExpr([:i, , :j]), EinExpr([:k, ]), EinExpr([, :l, :m])]
218218
expr = sum(tensors)
219219

220-
@test all(splat(==)), zip(expr.head, [:i, :j, :k, :l, :m])
220+
@test all(splat(==), zip(expr.head, [:i, :j, :k, :l, :m]))
221221
@test expr.args == tensors
222222

223223
@test issetequal(head(expr), [:i, :j, :k, :l, :m])

test/LineGraph_test.jl

Lines changed: 81 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,86 @@
11
@testset "LineGraph" begin
22
# connected
3-
network = SimpleTensorNetwork([
4-
Tensor(rand(2, 2), (:i, :m)),
5-
Tensor(rand(2, 2, 2), (:i, :j, :p)),
6-
Tensor(rand(2, 2, 2), (:n, :j, :k)),
7-
Tensor(rand(2, 2, 2), (:p, :k, :l)),
8-
Tensor(rand(2, 2, 2), (:m, :n, :o)),
9-
Tensor(rand(2, 2), (:o, :l)),
10-
])
11-
12-
path1 = einexpr(network; optimizer = Greedy())
13-
path2 = einexpr(network; optimizer = LineGraph())
14-
@test mapreduce(flops, +, Branches(path1)) >= mapreduce(flops, +, Branches(path2)) - 10
15-
@test contract(network; path = path1) contract(network; path = path2)
16-
17-
path1 = einexpr(network; optimizer = Greedy(), outputs = [:i, :p])
18-
path2 = einexpr(network; optimizer = LineGraph(), outputs = [:i, :p])
19-
@test mapreduce(flops, +, Branches(path1)) >= mapreduce(flops, +, Branches(path2)) - 10
20-
@test contract(network; path = path1) contract(network; path = path2)
3+
@testset let network = SizedEinExpr(
4+
EinExpr(
5+
Symbol[],
6+
[
7+
EinExpr([:i, :m])
8+
EinExpr([:i, :j, :p])
9+
EinExpr([:n, :j, :k])
10+
EinExpr([:p, :k, :l])
11+
EinExpr([:m, :n, :o])
12+
EinExpr([:o, :l])
13+
],
14+
),
15+
Dict(:i => 2, :j => 2, :k => 2, :l => 2, :m => 2, :n => 2, :o => 2, :p => 2),
16+
)
17+
path1 = einexpr(Greedy(), network)
18+
path2 = einexpr(LineGraph(), network)
19+
@test mapreduce(flops, +, Branches(path1)) >= mapreduce(flops, +, Branches(path2)) - 10
20+
21+
# TODO numerical test disabled due to circular dependency
22+
# @test contract(network; path = path1) ≈ contract(network; path = path2)
23+
end
24+
25+
@testset let network = SizedEinExpr(
26+
EinExpr(
27+
Symbol[:i, :p],
28+
[
29+
EinExpr([:i, :m])
30+
EinExpr([:i, :j, :p])
31+
EinExpr([:n, :j, :k])
32+
EinExpr([:p, :k, :l])
33+
EinExpr([:m, :n, :o])
34+
EinExpr([:o, :l])
35+
],
36+
),
37+
Dict(:i => 2, :j => 2, :k => 2, :l => 2, :m => 2, :n => 2, :o => 2, :p => 2),
38+
)
39+
path1 = einexpr(Greedy(), network)
40+
path2 = einexpr(LineGraph(), network)
41+
@test mapreduce(flops, +, Branches(path1)) >= mapreduce(flops, +, Branches(path2)) - 10
42+
43+
# TODO numerical test disabled due to circular dependency
44+
# @test contract(network; path = path1) ≈ contract(network; path = path2)
45+
end
2146

2247
# disconnected
23-
network = TensorNetwork([
24-
Tensor(rand(2, 2), (:i, :j)),
25-
Tensor(rand(2, 2), (:i, :j)),
26-
Tensor(rand(2, 2, 2), (:k, :l, :m)),
27-
Tensor(rand(2, 2, 2), (:k, :l, :m)),
28-
])
29-
30-
path1 = einexpr(network; optimizer = Greedy())
31-
path2 = einexpr(network; optimizer = LineGraph())
32-
@test mapreduce(flops, +, Branches(path1)) >= mapreduce(flops, +, Branches(path2)) - 10
33-
@test contract(network; path = path1) contract(network; path = path2)
34-
35-
path1 = einexpr(network; optimizer = Greedy(), outputs = [:i])
36-
path2 = einexpr(network; optimizer = LineGraph(), outputs = [:i])
37-
@test mapreduce(flops, +, Branches(path1)) >= mapreduce(flops, +, Branches(path2)) - 10
38-
@test contract(network; path = path1) contract(network; path = path2)
39-
40-
path1 = einexpr(network; optimizer = Greedy(), outputs = [:i, :k])
41-
path2 = einexpr(network; optimizer = LineGraph(), outputs = [:i, :k])
42-
@test mapreduce(flops, +, Branches(path1)) >= mapreduce(flops, +, Branches(path2)) - 10
43-
@test contract(network; path = path1) contract(network; path = path2)
48+
@testset let network = SizedEinExpr(
49+
EinExpr(Symbol[], [EinExpr([:i, :j]), EinExpr([:i, :j]), EinExpr([:k, :l, :m]), EinExpr([:k, :l, :m])]),
50+
Dict(:i => 2, :j => 2, :k => 2, :l => 2, :m => 2),
51+
)
52+
path1 = einexpr(network; optimizer = Greedy())
53+
path2 = einexpr(network; optimizer = LineGraph())
54+
@test mapreduce(flops, +, Branches(path1)) >= mapreduce(flops, +, Branches(path2)) - 10
55+
56+
# TODO numerical test disabled due to circular dependency
57+
# @test contract(network; path = path1) ≈ contract(network; path = path2)
58+
end
59+
60+
@testset let network = SizedEinExpr(
61+
EinExpr(Symbol[:i], [EinExpr([:i, :j]), EinExpr([:i, :j]), EinExpr([:k, :l, :m]), EinExpr([:k, :l, :m])]),
62+
Dict(:i => 2, :j => 2, :k => 2, :l => 2, :m => 2),
63+
)
64+
path1 = einexpr(Greedy(), network)
65+
path2 = einexpr(LineGraph(), network)
66+
@test mapreduce(flops, +, Branches(path1)) >= mapreduce(flops, +, Branches(path2)) - 10
67+
end
68+
69+
# TODO numerical test disabled due to circular dependency
70+
# @test contract(network; path = path1) ≈ contract(network; path = path2)
71+
72+
@testset let network = SizedEinExpr(
73+
EinExpr(
74+
Symbol[:i, :k],
75+
[EinExpr([:i, :j]), EinExpr([:i, :j]), EinExpr([:k, :l, :m]), EinExpr([:k, :l, :m])],
76+
),
77+
Dict(:i => 2, :j => 2, :k => 2, :l => 2, :m => 2),
78+
)
79+
path1 = einexpr(Greedy(), network)
80+
path2 = einexpr(LineGraph(), network)
81+
@test mapreduce(flops, +, Branches(path1)) >= mapreduce(flops, +, Branches(path2)) - 10
82+
83+
# TODO numerical test disabled due to circular dependency
84+
# @test contract(network; path = path1) ≈ contract(network; path = path2)
85+
end
4486
end

test/Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[deps]
22
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
33
CliqueTrees = "60701a23-6482-424a-84db-faee86b9b1f8"
4+
EinExprs = "b1794770-133b-4de1-afb4-526377e9f4c5"
45
GraphMakie = "1ecd5474-83a3-4783-bb4f-06765db800d2"
56
KaHyPar = "2a6221f6-aa48-11e9-3542-2d9e0ef01880"
67
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
78
Metis = "2679e427-3c69-5b7f-982b-ece356f1e94b"
89
NetworkLayout = "46757867-2c16-5918-afeb-47bfcb05e46a"
9-
Tenet = "85d41934-b9cd-44e1-8730-56d86f15f3ec"
1010
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1111

12-
[compat]
13-
Tenet = "0.9"
12+
[sources]
13+
EinExprs = {path = ".."}

test/runtests.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Test
2-
using Tenet
32
using EinExprs
43

54
@testset "Unit tests" verbose = true begin

0 commit comments

Comments
 (0)