def test_even_sequences():
 rng = np.random.RandomState(123)
 lengths = rng.randint(1, 10, 100)
 data = [(['w'] * l) for l in lengths]
 batch_size = 5
 my_iter = EvenSequencesSubsetIterator(data, batch_size)
 visited = ([False] * len(data))
 for ind_list in my_iter:
  assert [(len(data[i]) == len(data[ind_list[0]])) for i in ind_list]
  for i in ind_list:
   visited[i] = True
 assert all(visited)

def test_even_sequences ( ) : rng = np . random . RandomState ( 123 ) lengths = rng . randint ( 1 , 10 , 100 ) data = [ ( [ 'w' ] * l ) for l in lengths ] batch_size = 5 my_iter = EvenSequencesSubsetIterator ( data , batch_size ) visited = ( [ False ] * len ( data ) ) for ind_list in my_iter : assert [ ( len ( data [ i ] ) == len ( data [ ind_list [ 0 ] ] ) ) for i in ind_list ] for i in ind_list : visited [ i ] = True assert all ( visited )
check that evensequencessubsetiterator visits all entries in a dataset of sequence data .