Mercurial > pylearn
diff dataset.py @ 422:32c5f87bc54e
Added __len__ to HStackedDataSet and replaced default len() by sys.maxint instead of None
author | Yoshua Bengio <bengioy@iro.umontreal.ca> |
---|---|
date | Sat, 19 Jul 2008 14:12:41 -0400 |
parents | 835830e52b42 |
children | 0231eeac11c9 |
line wrap: on
line diff
--- a/dataset.py Sat Jul 19 10:11:22 2008 -0400 +++ b/dataset.py Sat Jul 19 14:12:41 2008 -0400 @@ -220,7 +220,8 @@ Sub-classes which implement finite-length datasets should redefine this method. Some methods only make sense for finite-length datasets. """ - return None + from sys import maxint + return maxint class MinibatchToSingleExampleIterator(object): @@ -943,6 +944,9 @@ del self.fieldname2dataset[fieldname] self.fieldname2dataset[rename_field(fieldname,self.datasets[i],i)]=i + def __len__(self): + return len(self.datasets[0]) + def hasFields(self,*fieldnames): for fieldname in fieldnames: if not fieldname in self.fieldname2dataset: