Mercurial > pylearn
comparison dataset.py @ 159:28a988bd19c3
bugfix: make the iterator advance
author | Frederic Bastien <bastienf@iro.umontreal.ca> |
---|---|
date | Mon, 12 May 2008 16:51:54 -0400 |
parents | f8a1ae7eb83e |
children | d7d67651d67c |
comparison
equal
deleted
inserted
replaced
158:90104343c665 | 159:28a988bd19c3 |
---|---|
1077 # cache everything from current length to upper | 1077 # cache everything from current length to upper |
1078 for example in self.dataset.source_dataset[cache_len:upper]: | 1078 for example in self.dataset.source_dataset[cache_len:upper]: |
1079 self.dataset.cached_examples.append(example) | 1079 self.dataset.cached_examples.append(example) |
1080 all_fields_minibatch = Example(self.dataset.fieldNames(), | 1080 all_fields_minibatch = Example(self.dataset.fieldNames(), |
1081 zip(*self.dataset.cached_examples[self.current:self.current+minibatch_size])) | 1081 zip(*self.dataset.cached_examples[self.current:self.current+minibatch_size])) |
1082 self.current+=1 | |
1082 if self.dataset.fieldNames()==fieldnames: | 1083 if self.dataset.fieldNames()==fieldnames: |
1083 return all_fields_minibatch | 1084 return all_fields_minibatch |
1084 return Example(fieldnames,[all_fields_minibatch[name] for name in fieldnames]) | 1085 return Example(fieldnames,[all_fields_minibatch[name] for name in fieldnames]) |
1085 return CacheIterator(self) | 1086 return CacheIterator(self) |
1086 | 1087 |