You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python 3.11.4 | packaged by conda-forge | (main, Jun 10 2023, 18:08:41) [Clang 15.0.7 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> import opt_einsum as oe
>>> x = np.random.randn(2,3,4)
>>> y = np.random.randn(2,3)
>>> np.einsum(x, [0,1,Ellipsis], y, [0,1], [0, Ellipsis])
array([[ 0.50400543, 1.60218127, -2.32967585, 2.806769 ],
[-1.86581498, 1.98371577, -3.15319885, -1.78047722]])
>>> oe.contract(x, [0,1,Ellipsis], y, [0,1], [0, Ellipsis])
array([[ 0.50400543, 1.60218127, -2.32967585, 2.806769 ],
[-1.86581498, 1.98371577, -3.15319885, -1.78047722]])
>>> oe.contract_expression(x.shape, [0,1,Ellipsis], y.shape, [0,1], [0, Ellipsis])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/homebrew/Caskroom/miniconda/base/envs/finest/lib/python3.11/site-packages/opt_einsum/contract.py", line 882, in contract_expression
return contract(subscripts, *dummy_arrays, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniconda/base/envs/finest/lib/python3.11/site-packages/opt_einsum/contract.py", line 497, in contract
operands, contraction_list = contract_path(*operands,
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniconda/base/envs/finest/lib/python3.11/site-packages/opt_einsum/contract.py", line 210, in contract_path
input_subscripts, output_subscript, operands = parser.parse_einsum_input(operands)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniconda/base/envs/finest/lib/python3.11/site-packages/opt_einsum/parser.py", line 309, in parse_einsum_input
if operands[num].shape == ():
^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: operands could not be broadcast together with shapes (3,) (0,)
I get the above error, which I assume must be some bug, since both oe.contract and np.einsum seem to be working. As a hint, this error does not occur, when using numpy 1.23.5.
Let me know, if you need any more input form me.
The text was updated successfully, but these errors were encountered:
I am using numpy 1.25.1 and opt_einsum 3.3.0.
I get the above error, which I assume must be some bug, since both oe.contract and np.einsum seem to be working. As a hint, this error does not occur, when using numpy 1.23.5.
Let me know, if you need any more input form me.
The text was updated successfully, but these errors were encountered: