Mercurial > pylearn
changeset 254:8ec867d12428
optimication in CachedDataSet.minibatches_nowrap
author | Frederic Bastien <bastienf@iro.umontreal.ca> |
---|---|
date | Tue, 03 Jun 2008 13:24:41 -0400 |
parents | 394e07e2b0fd |
children | bf0a1ebc6e52 |
files | dataset.py |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/dataset.py Tue Jun 03 13:23:28 2008 -0400 +++ b/dataset.py Tue Jun 03 13:24:41 2008 -0400 @@ -1141,6 +1141,7 @@ def __init__(self,dataset): self.dataset=dataset self.current=offset + self.all_fields = self.dataset.fieldNames()==fieldnames def __iter__(self): return self def next(self): upper = self.current+minibatch_size @@ -1152,7 +1153,7 @@ all_fields_minibatch = Example(self.dataset.fieldNames(), zip(*self.dataset.cached_examples[self.current:self.current+minibatch_size])) self.current+=minibatch_size - if self.dataset.fieldNames()==fieldnames: + if self.all_fields: return all_fields_minibatch return Example(fieldnames,[all_fields_minibatch[name] for name in fieldnames]) return CacheIterator(self)