diff dataset.py @ 344:a22ea54a19ed

bugfix, MinibatchDataSet.minibatches_nowrap() must raise StopIteration when needed
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Tue, 17 Jun 2008 14:46:10 -0400
parents d96be0eba3cc
children 7545207466d4
line wrap: on
line diff
--- a/dataset.py	Tue Jun 17 14:45:22 2008 -0400
+++ b/dataset.py	Tue Jun 17 14:46:10 2008 -0400
@@ -864,7 +864,8 @@
                 return self
             def next(self):
                 upper = self.next_example+minibatch_size
-                assert upper<=self.ds.length
+                if upper>self.ds.length:
+                    raise StopIteration
                 #minibatch = Example(self.ds._fields.keys(),
                 #                    [field[self.next_example:upper]
                 #                     for field in self.ds._fields])