diff dataset.py @ 64:863da25a60f1

trying to fix infinite loop
author Yoshua Bengio <bengioy@iro.umontreal.ca>
date Fri, 02 May 2008 11:01:28 -0400
parents 23bf2c9eb7b3
children d48eba49a2f4
line wrap: on
line diff
--- a/dataset.py	Fri May 02 10:14:24 2008 -0400
+++ b/dataset.py	Fri May 02 11:01:28 2008 -0400
@@ -552,11 +552,14 @@
             dataset = FieldsSubsetDataSet(dataset,fieldnames)
         assert dataset.hasFields(*fieldnames)
         self.dataset=dataset
-        minibatch_iterator = dataset.minibatches(fieldnames,
-                                                 minibatch_size=len(dataset),
-                                                 n_batches=1)
-        minibatch=minibatch_iterator.next()
-        LookupList.__init__(self,fieldnames,minibatch)
+        if isinstance(dataset,MinibatchDataSet):
+            LookupList.__init__(self,fieldnames,list(dataset._fields))
+        else:
+            minibatch_iterator = dataset.minibatches(fieldnames,
+                                                     minibatch_size=len(dataset),
+                                                     n_batches=1)
+            minibatch=minibatch_iterator.next()
+            LookupList.__init__(self,fieldnames,minibatch)
         
     def examples(self):
         return self.dataset