-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
When working with some types of data, I need to reshape arrays with zero elements. For example,
import numpy as np
import einx
import einops
arr = np.zeros((0, 0))
# numpy version - This works
reshaped_arr = np.expand_dims(arr, 0)
# einops version - This works as well
reshaped_arr_einops = einops.rearrange(arr, "... -> 1 ...")
# einx version - This does not
reshaped_arr_einx = einx.rearrange("... -> 1 ...", arr)The error is:
----> 1 einx.rearrange("... -> () ...", arr)
File /path/to/lib/python3.10/site-packages/einx/traceback_util.py:71, in filter.<locals>.func_with_reraise(*args, **kwargs)
69 except Exception as e:
70 tb = _filter_tb(e.__traceback__)
---> 71 raise e.with_traceback(tb) from None
72 finally:
73 del tb
SolveValueException: Failed to solve values of expressions. Axis '_anonymous_ellipsis_axis.0' has value 0 <= 0
Input:
'_anonymous_ellipsis_axis.0 _anonymous_ellipsis_axis.1 = 0 0'
'() _anonymous_ellipsis_axis.0 _anonymous_ellipsis_axis.1 = None
Metadata
Metadata
Assignees
Labels
No labels