Skip to content

Commit

Permalink
Fix "Wrong results for exhaustive search" #37
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing committed Oct 24, 2023
1 parent 30bffcd commit 8b58f75
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Optimizers/Exhaustive.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ function einexpr(config::Exhaustive, path; cost = BigInt(0))
end

function __einexpr_exhaustive_it(path, cost, metric, outer, leader, cache)
if length(path.args) <= 2
leader[] =
(; path = path, cost = mapreduce(metric, +, Branches(path, inverse = true), init = BigInt(0))::BigInt)
if length(path.args) == 1
# remove identity einsum (i.e. "i...->i...")
path = path.args[1]

leader[] = (; path, cost = mapreduce(metric, +, Branches(path, inverse = true), init = BigInt(0))::BigInt)
return
end

Expand Down

0 comments on commit 8b58f75

Please sign in to comment.