diff dataset.py @ 171:895b4b60f5e8

bugfix. Otherwise the example was writed over and not a new one was returned
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Tue, 13 May 2008 13:23:05 -0400
parents 4803cb76e26b
children f01ac276c6fb bda6d89d0b3d
line wrap: on
line diff
--- a/dataset.py	Tue May 13 13:09:59 2008 -0400
+++ b/dataset.py	Tue May 13 13:23:05 2008 -0400
@@ -4,7 +4,7 @@
 from misc import unique_elements_list_intersection
 from string import join
 from sys import maxint
-import numpy
+import numpy, copy
 
 from exceptions import *
 
@@ -1053,7 +1053,7 @@
           fields_values = source_dataset.minibatches(minibatch_size=len(source_dataset)).__iter__().next()
           assert all([len(self)==len(field_values) for field_values in fields_values])
           for example in fields_values.examples():
-              self.cached_examples.append(example)
+              self.cached_examples.append(copy.copy(example))
 
       self.fieldNames = source_dataset.fieldNames
       self.hasFields = source_dataset.hasFields