Closed yaroslavvb closed 4 years ago
The following breaks with optimize='dp' but works with default optimizer
import opt_einsum as oe einsum_string = 'a,bcd,efg->' views = oe.helpers.build_views(einsum_string, {c: 2 for c in einsum_string.replace(',->','')}) path, path_info = oe.contract_path(einsum_string, *views, optimize='dp') print(path_info)
produces
/usr/local/lib/python3.6/dist-packages/opt_einsum/contract.py in contract_path(*operands, **kwargs) 270 else: 271 path_optimizer = paths.get_path_fn(path_type) --> 272 path = path_optimizer(input_sets, output_set, dimension_dict, memory_arg) 273 274 cost_list = [] /usr/local/lib/python3.6/dist-packages/opt_einsum/paths.py in dynamic_programming(inputs, output, size_dict, memory_limit) 971 def dynamic_programming(inputs, output, size_dict, memory_limit=None): 972 optimizer = DynamicProgrammingOptimizer() --> 973 return optimizer(inputs, output, size_dict, memory_limit) 974 975 /usr/local/lib/python3.6/dist-packages/opt_einsum/paths.py in __call__(self, inputs, output, size_dict, memory_limit) 872 inputs, inputs_contractions = zip(*[ 873 (i - i_single, j if i.isdisjoint(i_single) else (j,)) --> 874 for j, i in enumerate(inputs) 875 if len(i - i_single) > 0 876 ]) ValueError: not enough values to unpack (expected 2, got 0)
I'm making a few small updates to 'dp' and will include a fix for this this shortly.
'dp'
This should be fixed by #119.
The following breaks with optimize='dp' but works with default optimizer
produces