Пример #1
0
 def test_update_dense_to_sparse(self):
     t = tile.from_shape(ARRAY_SIZE,
                         dtype=np.float32,
                         tile_type=tile.TYPE_SPARSE)
     update = np.ones(UPDATE_SHAPE)
     t.update(UPDATE_SUBSLICE, update, None)
     print t.data.todense()
Пример #2
0
 def test_create_sparse(self):
     t = tile.from_shape(ARRAY_SIZE,
                         dtype=np.float32,
                         tile_type=tile.TYPE_SPARSE)
     t._initialize()
     Assert.eq(t.data.shape, ARRAY_SIZE)
     Assert.eq(t.mask, None)
Пример #3
0
 def test_update_sparse_to_sparse(self):
   t = tile.from_shape(ARRAY_SIZE, dtype=np.float32, tile_type=tile.TYPE_SPARSE)
   update = sp.lil_matrix(ARRAY_SIZE, dtype=np.float32)
   for i in range(UPDATE_SHAPE[0]):
     update[i,i] = 1
   t.update(UPDATE_SUBSLICE, update, None)
   Assert.eq(sp.issparse(t.data), True)
   print t.data.todense()
Пример #4
0
 def test_update_sparse_to_dense(self):
   t = tile.from_shape(ARRAY_SIZE, dtype=np.float32, tile_type=tile.TYPE_DENSE)
   update = sp.lil_matrix(ARRAY_SIZE, dtype=np.float32)
   for i in range(UPDATE_SHAPE[0]):
     update[i,i] = 1
   t.update(UPDATE_SUBSLICE, update, None)
   print t.data
   print t.mask
Пример #5
0
 def test_update_sparse_to_sparse(self):
     t = tile.from_shape(ARRAY_SIZE,
                         dtype=np.float32,
                         tile_type=tile.TYPE_SPARSE)
     update = sp.lil_matrix(ARRAY_SIZE, dtype=np.float32)
     for i in range(UPDATE_SHAPE[0]):
         update[i, i] = 1
     t.update(UPDATE_SUBSLICE, update, None)
     Assert.eq(sp.issparse(t.data), True)
     print t.data.todense()
Пример #6
0
 def test_update_sparse_to_dense(self):
     t = tile.from_shape(ARRAY_SIZE,
                         dtype=np.float32,
                         tile_type=tile.TYPE_DENSE)
     update = sp.lil_matrix(ARRAY_SIZE, dtype=np.float32)
     for i in range(UPDATE_SHAPE[0]):
         update[i, i] = 1
     t.update(UPDATE_SUBSLICE, update, None)
     print t.data
     print t.mask
Пример #7
0
 def test_update_dense_to_sparse(self):
   t = tile.from_shape(ARRAY_SIZE, dtype=np.float32, tile_type=tile.TYPE_SPARSE)
   update = np.ones(UPDATE_SHAPE)
   t.update(UPDATE_SUBSLICE, update, None)
   print t.data.todense()
Пример #8
0
 def test_create_sparse(self):
   t = tile.from_shape(ARRAY_SIZE, dtype=np.float32, tile_type=tile.TYPE_SPARSE)
   t._initialize()
   Assert.eq(t.data.shape, ARRAY_SIZE)
   Assert.eq(t.mask, None) 
Пример #9
0
 def test_create_dense(self):
   t = tile.from_shape(ARRAY_SIZE, dtype=np.float32, tile_type=tile.TYPE_DENSE)
   t._initialize()
   Assert.eq(t.mask.shape, ARRAY_SIZE)
Пример #10
0
 def test_create_dense(self):
     t = tile.from_shape(ARRAY_SIZE,
                         dtype=np.float32,
                         tile_type=tile.TYPE_DENSE)
     t._initialize()
     Assert.eq(t.mask.shape, ARRAY_SIZE)