def test_numpy_slices_distributed_sampler():
    logger.info('Test distributed sampler.')
    np_data = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16]]
    ds = de.NumpySlicesDataset(np_data, shuffle=False, shard_id=0, num_shards=4)
    for (i, data) in enumerate(ds):
        assert np.equal(data[0], np_data[(i * 4)]).all()
    assert (sum([1 for _ in ds]) == 2)
def test_numpy_slices_distributed_sampler():
    logger.info('Test distributed sampler.')
    np_data = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10], [11, 12], [13, 14], [15, 16]]
    ds = de.NumpySlicesDataset(np_data, shuffle=False, shard_id=0, num_shards=4)
    for (i, data) in enumerate(ds):
        assert np.equal(data[0], np_data[(i * 4)]).all()
    assert (sum([1 for _ in ds]) == 2)