Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contract_path with optimize='optimal' not working on small example #243

Open
ryan112358 opened this issue Nov 16, 2024 · 1 comment
Open

Comments

@ryan112358
Copy link

Cross posting from jax-ml/jax#24929

import opt_einsum
import numpy as np

formula = 'a,c,d,db,ab,cb,ac,cd,ad,b->dbc'

arrays = [np.random.rand(*(2,)*len(key)) for key in formula.split('->')[0].split(',')]
opt_einsum.contract_path(
    formula, *arrays, einsum_call=True, use_blas=True, optimize='optimal')  # this hangs and does not complete
@dgasmith
Copy link
Owner

One caution is the optimal algorithm scales factorially, with 10 input arrays you are generally pushing the limits with 10's of seconds to minutes runtime. You will find similar results with the dp algorithm which has much better runtimes or this particular contraction can be evaluated with greedy for what is likely to be the optimal path. We generally recommend optimize='auto' to balance path finding/path quality for input formula. More information can be found here.

I'll check out your example to see if it's an actual hang or just a long path evaluation time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants