# HG changeset patch # User Frederic Bastien # Date 1212072095 14400 # Node ID 77b362a23f8ee07328f1f9573fee48a1d26da939 # Parent ae1d85aca8586a1a1885bd133b39f6e8f9d0d7b3 more general test diff -r ae1d85aca858 -r 77b362a23f8e test_dataset.py --- a/test_dataset.py Thu May 29 10:30:59 2008 -0400 +++ b/test_dataset.py Thu May 29 10:41:35 2008 -0400 @@ -194,33 +194,33 @@ m=ds.minibatches(['x','y'],n_batches=1,minibatch_size=3,offset=4) assert isinstance(m,DataSet.MinibatchWrapAroundIterator) for x,y in m: - assert len(x)==3 - assert len(y)==3 - for id in range(3): + assert len(x)==m.minibatch_size + assert len(y)==m.minibatch_size + for id in range(m.minibatch_size): assert (numpy.append(x[id],y[id])==array[i+4]).all() i+=1 - assert i==3 + assert i==m.n_batches*m.minibatch_size del x,y,i,id,m i=0 m=ds.minibatches(['x','y'],n_batches=2,minibatch_size=3,offset=4) assert isinstance(m,DataSet.MinibatchWrapAroundIterator) for x,y in m: - assert len(x)==3 - assert len(y)==3 - for id in range(3): + assert len(x)==m.minibatch_size + assert len(y)==m.minibatch_size + for id in range(m.minibatch_size): assert (numpy.append(x[id],y[id])==array[i+4]).all() i+=1 - assert i==6 + assert i==m.n_batches*m.minibatch_size del x,y,i,id,m i=0 m=ds.minibatches(['x','y'],n_batches=20,minibatch_size=3,offset=4) assert isinstance(m,DataSet.MinibatchWrapAroundIterator) for x,y in m: - assert len(x)==3 - assert len(y)==3 - for id in range(3): + assert len(x)==m.minibatch_size + assert len(y)==m.minibatch_size + for id in range(m.minibatch_size): assert (numpy.append(x[id],y[id])==array[(i+4)%array.shape[0]]).all() i+=1 assert i==m.n_batches*m.minibatch_size