Пример #1
0
 def test_slice_map(self):
   x = expr.arange((TEST_SIZE, TEST_SIZE))
   z = x[5:8, 5:8]
   z = expr.map(z, add_one_tile)
   print z
   nx = np.arange(TEST_SIZE*TEST_SIZE).reshape(TEST_SIZE, TEST_SIZE)
   
   Assert.all_eq(z.glom(), nx[5:8, 5:8] + 1)
Пример #2
0
 def test_slice_map2(self):
   x = expr.arange((10, 10, 10), dtype=np.int)
   nx = np.arange(10 * 10 * 10, dtype=np.int).reshape((10, 10, 10))
   
   y = x[:, :, 0]
   z = expr.map(y, lambda tile: tile + 13)
   val = z.glom()
  
   Assert.all_eq(val.reshape(10, 10), nx[:, :, 0] + 13)