diff test_dataset.py @ 246:0fb75fdd727d

better function name in test_speed
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Tue, 03 Jun 2008 12:13:17 -0400
parents 97f35d586727
children 474be3d12c23
line wrap: on
line diff
--- a/test_dataset.py	Mon Jun 02 11:59:41 2008 -0400
+++ b/test_dataset.py	Tue Jun 03 12:13:17 2008 -0400
@@ -500,38 +500,52 @@
     ds = ArrayDataSet(a2,{'all':slice(0,a2.shape[1],1)})
     mat = numpy.random.rand(400,100)
     @print_timing
-    def f_array1(a):
+    def f_array_full(a):
         a+1
     @print_timing
-    def f_array2(a):
+    def f_array_index(a):
         for id in range(a.shape[0]):
 #            pass
             a[id]+1
 #            a[id]*mat
     @print_timing
-    def f_ds(ds):
+    def f_array_iter(a):
+        for r in a:
+#            pass
+            r+1
+#            r*mat
+    @print_timing
+    def f_ds_index(ds):
+        for id in range(len(ds)):
+#            pass
+            ds[id][0]+1
+#            ds[id][0]*mat
+    @print_timing
+    def f_ds_iter(ds):
         for ex in ds:
 #            pass
             ex[0]+1
-#            a[id]*mat
+#            a[0]*mat
     @print_timing
     def f_ds_mb1(ds,mb_size):
         for exs in ds.minibatches(minibatch_size = mb_size):
             for ex in exs:
 #                pass
                 ex[0]+1
-#                ex[id]*mat
+#                ex[0]*mat
     @print_timing
     def f_ds_mb2(ds,mb_size):
         for exs in ds.minibatches(minibatch_size = mb_size):
 #            pass
             exs[0]+1
-#            ex[id]*mat
+#            ex[0]*mat
 
-    f_array1(a2)
-    f_array2(a2)
+    f_array_full(a2)
+    f_array_index(a2)
+    f_array_iter(a2)
 
-    f_ds(ds)
+    f_ds_index(ds)
+    f_ds_iter(ds)
 
     f_ds_mb1(ds,10)
     f_ds_mb1(ds,100)