예제 #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)