comparison dataset.py @ 150:9abd19af822e

bugfix
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Mon, 12 May 2008 15:51:30 -0400
parents ceae4de18981
children 39bb21348fdf
comparison
equal deleted inserted replaced
149:feec9039b941 150:9abd19af822e
1074 if upper>cache_len: # whole minibatch is not already in cache 1074 if upper>cache_len: # whole minibatch is not already in cache
1075 # cache everything from current length to upper 1075 # cache everything from current length to upper
1076 for example in self.dataset.source_dataset[cache_len:upper]: 1076 for example in self.dataset.source_dataset[cache_len:upper]:
1077 self.dataset.cached_examples.append(example) 1077 self.dataset.cached_examples.append(example)
1078 all_fields_minibatch = Example(self.dataset.fieldNames(), 1078 all_fields_minibatch = Example(self.dataset.fieldNames(),
1079 self.dataset.cached_examples[self.current:self.current+minibatch_size]) 1079 *self.dataset.cached_examples[self.current:self.current+minibatch_size])
1080 if self.dataset.fieldNames()==fieldnames: 1080 if self.dataset.fieldNames()==fieldnames:
1081 return all_fields_minibatch 1081 return all_fields_minibatch
1082 return Example(fieldnames,[all_fields_minibatch[name] for name in fieldnames]) 1082 return Example(fieldnames,[all_fields_minibatch[name] for name in fieldnames])
1083 return CacheIterator(self) 1083 return CacheIterator(self)
1084 1084