comparison test_dataset.py @ 164:3518710e16ec

don't assume we have an ArrayDataSet
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Mon, 12 May 2008 17:43:53 -0400
parents 45427d4d64b3
children 2a12e7437c56
comparison
equal deleted inserted replaced
163:d7d67651d67c 164:3518710e16ec
156 m=ds.minibatches(['x','z'], minibatch_size=3) 156 m=ds.minibatches(['x','z'], minibatch_size=3)
157 assert isinstance(m,DataSet.MinibatchWrapAroundIterator) 157 assert isinstance(m,DataSet.MinibatchWrapAroundIterator)
158 for x,z in m: 158 for x,z in m:
159 test_minibatch_field_size(x,m.minibatch_size,len(ds),mi) 159 test_minibatch_field_size(x,m.minibatch_size,len(ds),mi)
160 test_minibatch_field_size(z,m.minibatch_size,len(ds),mi) 160 test_minibatch_field_size(z,m.minibatch_size,len(ds),mi)
161 assert (x[:,0:3:2]==z).all() 161 for id in range(len(x)):
162 i+=len(x) 162 assert (x[id][::2]==z[id]).all()
163 i+=1
163 mi+=1 164 mi+=1
164 assert i==len(ds) 165 assert i==len(ds)
165 assert mi==4 166 assert mi==4
166 del x,z,i,m,mi 167 del x,z,i,m,mi
167 i=0 168 i=0