Mercurial > pylearn
changeset 239:77b362a23f8e
more general test
author | Frederic Bastien <bastienf@iro.umontreal.ca> |
---|---|
date | Thu, 29 May 2008 10:41:35 -0400 |
parents | ae1d85aca858 |
children | 97f35d586727 |
files | test_dataset.py |
diffstat | 1 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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