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
{{ message }}
Repository navigation
dpctl.tensor.reshape raises ValueError with empty list as input #729
import dpctl.tensor as dpt
a = dpt.asarray([])
dpt.reshape(a, (0,))
Output:
Traceback (most recent call last):
File "/localdisk/work/plukiche/dpnp_fork/dpctl_empty_reshape_repro.py", line 4, in <module>
dpt.reshape(a, (0,))
File "/localdisk/work/plukiche/miniconda/miniconda3/envs/dpnptc4_internal/lib/python3.8/site-packages/dpctl/tensor/_reshape.py", line 107, in reshape
newsts = reshaped_strides(X.shape, X.strides, newshape, order=order)
File "/localdisk/work/plukiche/miniconda/miniconda3/envs/dpnptc4_internal/lib/python3.8/site-packages/dpctl/tensor/_reshape.py", line 50, in reshaped_strides
for flat_index in [
File "/localdisk/work/plukiche/miniconda/miniconda3/envs/dpnptc4_internal/lib/python3.8/site-packages/dpctl/tensor/_reshape.py", line 51, in <listcomp>
np.ravel_multi_index(unitvec, new_sh, order=order)
File "<__array_function__ internals>", line 5, in ravel_multi_index
ValueError: cannot unravel if shape has zero entries (is empty).
Activity
LukichevaPolina commentedon Jan 13, 2022
@oleksandr-pavlyk, Could you please look at this problem?
densmirn commentedon Jan 21, 2022
@oleksandr-pavlyk, could you please either leave a comment or prepare a fix on this issue? The issue is blocking DPNP testing in external CI.
oleksandr-pavlyk commentedon Feb 1, 2022
The immediate error is caused by attempting to use
np.ravel_multi_indexfor shape with zero elements. That case should be handled separately.Fixes #729
Merge pull request #756 from IntelPython/bugfix/gh-729-reshape
Fixes #729