diff _test_dataset.py @ 7:6f8f338686db

Moved iterating counter into a FiniteDataSetIterator to allow embedded iterations and multiple threads iterating at the same time on a dataset.
author bengioy@bengiomac.local
date Mon, 24 Mar 2008 13:20:15 -0400
parents d5738b79089a
children d1c394486037
line wrap: on
line diff
--- a/_test_dataset.py	Mon Mar 24 09:04:06 2008 -0400
+++ b/_test_dataset.py	Mon Mar 24 13:20:15 2008 -0400
@@ -16,14 +16,24 @@
         a=ArrayDataSet(data=numpy.random.rand(8,3),fields={"x":slice(2),"y":slice(1,3)},minibatch_size=1)
         s=0
         for example in a:
+            print len(example), example.x
             s+=_sum_all(example.x)
         print s
-        self.failUnless(abs(s-11.4674133)<1e-6)
+        self.failUnless(abs(s-7.25967597)<1e-6)
+
+    def test1(self):
+        a=ArrayDataSet(data=numpy.random.rand(10,4),fields={"x":slice(2),"y":slice(1,4)},minibatch_size=1)
         a.minibatch_size=2
+        print a.asarray()
         for mb in a:
+            print mb,mb.asarray()
+        print "a.y=",a.y
+        for mb in ArrayDataSet(data=a.y,minibatch_size=2):
             print mb
-            
-
+            for e in mb:
+                print e
+        self.failUnless(True)
+        
 if __name__ == '__main__':
     unittest.main()