dgasmith / opt_einsum

⚡️Optimizing einsum functions in NumPy, Tensorflow, Dask, and more with contraction order optimization.
https://dgasmith.github.io/opt_einsum/
MIT License
863 stars 68 forks source link

optimize='dp' gets confused by singleton factors #118

Closed yaroslavvb closed 4 years ago

yaroslavvb commented 5 years ago

This hangs with 100% utilization.

import opt_einsum as oe
einsum_string = 'nlp,nlq->n'
views = oe.helpers.build_views(einsum_string, {'n': 30, 'i': 100, 'l': 100, 'p': 2, 'q': 2, 'z': 1})
path, path_info = oe.contract_path(einsum_string, *views,optimize='dp')
print(path_info)

Changing optimizer or increasing size of z factor works

jcmgray commented 5 years ago

Ah this is because of the costcapping strategy. I'll fix this in the upcoming tweaks to 'dp'.

jcmgray commented 4 years ago

This should be fixed by #119.