Bug: Dynamic_programming path solver may return illegal contraction path
refraction-ray opened this issue · 5 comments
refraction-ray commented
Tested on GitHub master HEAD.
oem.paths.dynamic_programming([{0,1}, {}], {0, 1}, {0:2, 1:2})
[(1,), (0, 1)] # sth. wrong here
oem.paths.greedy([{0,1}, {}], {0, 1}, {0:2, 1:2})
[(0, 1)] # other solvers return correct result
Though such tensor contraction case is weird and a very corner case, it indeed can occur in https://github.com/google/TensorNetwork/blob/master/tensornetwork/quantum/quantum.py
dgasmith commented
Thanks for the report, let me look into it.
dgasmith commented
Looking into this it appears a pre optimization trigger causes the float to be self contracted (a no-op) and is fixed in #172. As a note the resulting contraction path is perfectly valid, just a bit of wasted effort there equivalent to np.einsum('->', 5)
.
refraction-ray commented
The new commit on bug/dynamic-singles branch fixes this issue :)
Feel free to close this issue or if you want to keep it open until the bug-fix get merged into master or get released
jcmgray commented
Sounds good to me!