Beispiel #1
0
 def test_3d_three_channel_input():
     shape = rand_shape_3d()
     shape = (3,) + shape[1:]
     data = rand_ndarray(shape, 'default')
     grid = make_image_grid(data)
     assert grid.ndim == 3
     assert grid.shape[0] == 3
     assert same(grid.asnumpy(), data.asnumpy())
Beispiel #2
0
 def test_3d_single_channel_input():
     shape = rand_shape_3d(dim0=1)
     data = rand_ndarray(shape, 'default')
     assert data.shape[0] == 1  # single channel
     grid = make_image_grid(data)
     assert grid.ndim == 3
     assert grid.shape[0] == 3
     assert same(grid[0].asnumpy(), grid[1].asnumpy())
     assert same(grid[0].asnumpy(), grid[2].asnumpy())
     assert same(grid[0:1].asnumpy(), data.asnumpy())
Beispiel #3
0
 def test_2d_input():
     shape = rand_shape_2d()
     data = rand_ndarray(shape, 'default')
     grid = make_image_grid(data)
     assert grid.ndim == 3
     assert grid.shape[0] == 3
     assert grid.shape[1:] == data.shape
     assert same(grid[0].asnumpy(), grid[1].asnumpy())
     assert same(grid[0].asnumpy(), grid[2].asnumpy())
     assert same(grid[0].asnumpy(), data.asnumpy())
Beispiel #4
0
 def test_4d_multiple_batch_input():
     shape_list = list(rand_shape_nd(4))
     shape_list[0] = 10
     num_channels = [1, 3]
     for c in num_channels:
         shape_list[1] = c
         shape = tuple(shape_list)
         data = rand_ndarray(shape, 'default')
         grid = make_image_grid(data)
         assert grid.ndim == 3
         assert grid.shape[0] == 3
Beispiel #5
0
 def test_4d_single_batch_single_channel_input():
     shape = list(rand_shape_nd(4))
     shape[0] = 1
     shape[1] = 1
     shape = tuple(shape)
     data = rand_ndarray(shape, 'default')
     grid = make_image_grid(data)
     assert grid.ndim == 3
     assert grid.shape[0] == 3
     assert same(grid[0].asnumpy(), grid[1].asnumpy())
     assert same(grid[0].asnumpy(), grid[2].asnumpy())
     assert same(grid[0].reshape(data.shape).asnumpy(), data.asnumpy())