Mercurial > pylearn
changeset 43:e92244f30116
Corrected iterator logic errors
author | bengioy@grenat.iro.umontreal.ca |
---|---|
date | Mon, 28 Apr 2008 11:41:28 -0400 |
parents | 9b68774fcc6b |
children | 5a85fda9b19b |
files | dataset.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/dataset.py Fri Apr 25 16:00:31 2008 -0400 +++ b/dataset.py Mon Apr 28 11:41:28 2008 -0400 @@ -197,7 +197,7 @@ return self.next_row def next(self): - if self.n_batches and self.n_batches_done==self.n_batches + if self.n_batches and self.n_batches_done==self.n_batches: raise StopIteration upper = self.next_row+self.minibatch_size if upper <=self.L: @@ -214,7 +214,7 @@ for name in self.fieldnames]) self.next_row=upper self.n_batches_done+=1 - if upper >= self.L: + if upper >= self.L and self.n_batches: self.next_row -= self.L return minibatch @@ -900,6 +900,7 @@ def next(self): sub_data = self.dataset.data[self.current:self.current+self.minibatch_size] self._values = [sub_data[:,self.dataset.fields_columns[f]] for f in self._names] + self.current+=self.minibatch_size return self return Iterator(self,fieldnames,minibatch_size,n_batches,offset)