-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
DOC: default value of optimize in numpy.einsum #12294
Copy link
Copy link
Closed
Description
In the documentation page https://docs.scipy.org/doc/numpy-1.15.1/reference/generated/numpy.einsum.html, the default value of optimize is correctly stated to be False in the function signature, but erroneously stated to be True in the parameter description:
optimize : {False, True, ‘greedy’, ‘optimal’}, optional
Controls if intermediate optimization should occur. No optimization will occur if False and True will default to the ‘greedy’ algorithm. Also accepts an explicit contraction list from the np.einsum_path function. See np.einsum_path for more details. Default is True.
Reproducing code example:
import timeit
print(timeit.timeit("np.einsum('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C, optimize = True)", 'import numpy as np; I = np.random.rand(10, 10, 10, 10); C = np.random.rand(10, 10)', number = 10))
print(timeit.timeit("np.einsum('ea,fb,abcd,gc,hd->efgh', C, C, I, C, C)", 'import numpy as np; I = np.random.rand(10, 10, 10, 10); C = np.random.rand(10, 10)', number = 10))The second line should run much slower than the first line.
Numpy/Python version information:
1.15.1 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
[Clang 6.0 (clang-600.0.57)]
Reactions are currently unavailable