Mercurial > pylearn
comparison dataset.py @ 329:9ce791fb2cbf
little hack in MiniBatchToSingleExampleIterator, there was a problem which I think was not a bug, we were receiving [array(3)] and everything was crashing. Hack is kinda slow
author | Thierry Bertin-Mahieux <bertinmt@iro.umontreal.ca> |
---|---|
date | Mon, 16 Jun 2008 16:03:16 -0400 |
parents | ad8be93b3c55 |
children | 20e08c52c98c |
comparison
equal
deleted
inserted
replaced
327:2480024bf401 | 329:9ce791fb2cbf |
---|---|
238 def __iter__(self): #makes for loop work | 238 def __iter__(self): #makes for loop work |
239 return self | 239 return self |
240 def next(self): | 240 def next(self): |
241 size1_minibatch = self.minibatch_iterator.next() | 241 size1_minibatch = self.minibatch_iterator.next() |
242 if not self.minibatch: | 242 if not self.minibatch: |
243 self.minibatch = Example(size1_minibatch.keys(),[value[0] for value in size1_minibatch.values()]) | 243 names = size1_minibatch.keys() |
244 # next lines are a hack, but there was problem when we were getting [array(327)] for instance | |
245 if len(size1_minibatch.values()[0].shape) > 0 : | |
246 values = [value[0] for value in size1_minibatch.values()] | |
247 else : | |
248 values = [value for value in size1_minibatch.values()] | |
249 self.minibatch = Example(names,values) | |
244 else: | 250 else: |
245 self.minibatch._values = [value[0] for value in size1_minibatch.values()] | 251 self.minibatch._values = [value[0] for value in size1_minibatch.values()] |
246 return self.minibatch | 252 return self.minibatch |
247 | 253 |
248 def next_index(self): | 254 def next_index(self): |