[NumPy-Tickets] [NumPy] #1505: load() yields corrupted/incorrect data

NumPy Trac numpy-tickets@scipy....
Wed Jan 25 13:15:57 CST 2012


#1505: load() yields corrupted/incorrect data
-------------------------+--------------------------------------------------
  Reporter:  RRosario    |       Owner:  somebody                      
      Type:  defect      |      Status:  closed                        
  Priority:  high        |   Milestone:  1.6.0                         
 Component:  numpy.core  |     Version:  1.4.0                         
Resolution:  worksforme  |    Keywords:  load save corrupt inconsistent
-------------------------+--------------------------------------------------

Comment(by andreh):

 I discovered a similar problem with coo_matrix : {{{shape}}} is not the
 same after serialization .

 Replying to [comment:3 pv]:
 > Works for me.
 > {{{
 > >>> import numpy as np
 > >>> import scipy.sparse as sparse
 > >>> x = sparse.lil_matrix((395000,395000))
 > >>> x[:,10] = 1
 > >>> x[10,:] = 1
 > >>> x = x.tocsc()
 > >>> np.save('dump.npy', x.indices)
 > >>> y = np.load('dump.npy')
 > >>> np.allclose(x.indices, y)
 > True
 > }}}

 In fact in your example
 {{{
 x.shape
 }}}
 gives
 {{{
 (395000, 395000)
 }}}
 while
 {{{
 y.shape
 }}}
 gives
 {{{
 (789999,)
 }}}

 Looking at the first bytes of dump.npy one sees
 {{{
 'shape': (789999,)
 }}}
 so the loss of the shape transformation is likely to happen already during
 serialization.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1505#comment:6>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list