Mercurial > pylearn
diff 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 |
line wrap: on
line diff
--- a/dataset.py Mon Jun 16 12:57:32 2008 -0400 +++ b/dataset.py Mon Jun 16 16:03:16 2008 -0400 @@ -240,7 +240,13 @@ def next(self): size1_minibatch = self.minibatch_iterator.next() if not self.minibatch: - self.minibatch = Example(size1_minibatch.keys(),[value[0] for value in size1_minibatch.values()]) + names = size1_minibatch.keys() + # next lines are a hack, but there was problem when we were getting [array(327)] for instance + if len(size1_minibatch.values()[0].shape) > 0 : + values = [value[0] for value in size1_minibatch.values()] + else : + values = [value for value in size1_minibatch.values()] + self.minibatch = Example(names,values) else: self.minibatch._values = [value[0] for value in size1_minibatch.values()] return self.minibatch