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
When input a N-by-1 matrix of type np.matrix, sparse.as_coo throws an error. It correctly dispatchs to sparse.COO.from_numpy but can not handle it. Please see the following
In [1]: importscipy.sparse,sparseIn [2]: sp=scipy.sparse.random(10,1,0.5)
In [3]: mat=sp.argmax(1)
In [4]: sparse.as_coo(mat)
---------------------------------------------------------------------------ValueErrorTraceback (mostrecentcalllast)
<ipython-input-4-5492fc8fff45>in<module>()
---->1sparse.as_coo(mat)
C:\Users\Liyu\Anaconda3\lib\site-packages\sparse\coo\core.pyinas_coo(x, shape, fill_value)
17491750ifisinstance(x, np.ndarray):
->1751returnCOO.from_numpy(x, fill_value=fill_value)
17521753ifisinstance(x, scipy.sparse.spmatrix):
C:\Users\Liyu\Anaconda3\lib\site-packages\sparse\coo\core.pyinfrom_numpy(cls, x, fill_value)
308data=np.array(x, ndmin=1)
309returncls(coords, data, shape=x.shape, has_duplicates=False,
-->310sorted=True, fill_value=fill_value)
311312deftodense(self):
C:\Users\Liyu\Anaconda3\lib\site-packages\sparse\coo\core.pyin__init__(self, coords, data, shape, has_duplicates, sorted, cache, fill_value)
223msg= ('The data length does not match the coordinates '224'given.\nlen(data) = {}, but {} coords specified.')
-->225raiseValueError(msg.format(len(data), self.coords.shape[1]))
226iflen(self.shape) !=self.coords.shape[0]:
227msg= ("Shape specified by `shape` doesn't match the "ValueError: Thedatalengthdoesnotmatchthecoordinatesgiven.
len(data) =1, but0coordsspecified.
The text was updated successfully, but these errors were encountered:
When input a N-by-1 matrix of type np.matrix, sparse.as_coo throws an error. It correctly dispatchs to sparse.COO.from_numpy but can not handle it. Please see the following
The text was updated successfully, but these errors were encountered: