Skip to content

Commit 5c169d9

Browse files
committed
fix tests
1 parent 0d578d8 commit 5c169d9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/networks.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
function generate_tensors(x::T, m::ConstraintSatisfactionProblem) where T
2-
terms = ProblemReductions.size_terms(m)
3-
tensors = [reshape(map(s -> !s.is_valid ? zero(x) : _pow(x, s.size), t.solution_sizes), ntuple(i->num_flavors(m), length(t.variables))) for t in terms]
4-
ixs = [t.variables for t in terms]
2+
cons = ProblemReductions.constraints(m)
3+
objs = ProblemReductions.objectives(m)
4+
tensors = vcat(
5+
[reshape(map(s -> s ? one(x) : zero(x), t.specification), ntuple(i->num_flavors(m), length(t.variables))) for t in cons],
6+
[reshape(map(s -> _pow(x, s.size), t.specification), ntuple(i->num_flavors(m), length(t.variables))) for t in objs]
7+
)
8+
ixs = vcat([t.variables for t in cons], [t.variables for t in objs])
59
return add_labels!(tensors, ixs, variables(m))
610
end
711
function rawcode(problem::ConstraintSatisfactionProblem; openvertices=())
8-
ixs = [t.variables for t in ProblemReductions.size_terms(problem)]
12+
ixs = vcat([t.variables for t in ProblemReductions.constraints(problem)], [t.variables for t in ProblemReductions.objectives(problem)])
913
LT = eltype(eltype(ixs))
1014
return DynamicEinCode(ixs, collect(LT, openvertices)) # labels for edge tensors
1115
end

0 commit comments

Comments
 (0)