changeset 1453:d9dd09a2ee90

added loop argument to cifar10 op constructor
author James Bergstra <bergstrj@iro.umontreal.ca>
date Mon, 04 Apr 2011 18:59:18 -0400
parents d862047c2fe7
children 283fb236f104
files pylearn/dataset_ops/cifar10.py
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/dataset_ops/cifar10.py	Fri Apr 01 10:06:03 2011 -0400
+++ b/pylearn/dataset_ops/cifar10.py	Mon Apr 04 18:59:18 2011 -0400
@@ -73,15 +73,21 @@
 def all_labels():
     return all_data_labels()[1]
 
+split_sizes = dict(
+        train=40000,
+        valid=10000,
+        test=10000,
+        all=60000)
 
 def cifar10(s_idx, split, dtype='float64', rasterized=False, color='grey',
         split_options = {'train':(train_data, train_labels),
                 'valid': (valid_data, valid_labels),
                 'test': (test_data, test_labels),
                 'all': (all_data, all_labels),
-                }
+                },
+        loop=False
             ):
-    """ 
+    """
     Returns a pair (img, label) of theano expressions for cifar-10 samples
 
     :param s_idx: the indexes
@@ -110,6 +116,9 @@
     x_op = TensorFnDataset(dtype, (False,), (x_fn, (dtype,)), (3072,))
     y_op = TensorFnDataset('int32', (), y_fn)
 
+    if loop:
+        s_idx = s_idx % split_sizes[split]
+
     x = x_op(s_idx)
     y = y_op(s_idx)