-
-
Notifications
You must be signed in to change notification settings - Fork 12.3k
ENH: Einsum does not support object dtype #17837
Copy link
Copy link
Closed
Labels
Description
Reproducing code example:
import numpy as np
def dot(dim):
x = np.random.rand(dim, dim).astype(object)
y = np.random.rand(dim, dim).astype(object)
print(np.einsum("ij,jk->ik", x, y, optimize=True))
dot(2) # ok
dot(3) # ok
dot(1) # errorError message:
Traceback (most recent call last):
File "einsum.py", line 17, in
main()
File "einsum.py", line 13, in main
sum(dim)
File "einsum.py", line 8, in sum
print(np.einsum("ij,jk->ik", x, y, optimize=True))
File "<array_function internals>", line 6, in einsum
File "/Users/sage/Documents/venvs/FATE/lib/python3.6/site-packages/numpy/core/einsumfunc.py", line 1423, in einsum
new_view = c_einsum(einsum_str, *tmp_operands, **einsum_kwargs)
TypeError: invalid data type for einsum
NumPy/Python version information:
1.18.4 3.6.10 |Anaconda, Inc.| (default, May 7 2020, 23:06:31)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
Reactions are currently unavailable