changeset 1420:7374d676c9b0

dataset_ops/tinyimages - added a tinyimages_op that gives access to the full dataset, not just patches.
author James Bergstra <bergstrj@iro.umontreal.ca>
date Fri, 04 Feb 2011 16:06:00 -0500
parents cff305ad9f60
children 3dee72c3055d
files pylearn/dataset_ops/tinyimages.py
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/dataset_ops/tinyimages.py	Fri Feb 04 16:05:22 2011 -0500
+++ b/pylearn/dataset_ops/tinyimages.py	Fri Feb 04 16:06:00 2011 -0500
@@ -34,6 +34,21 @@
 # pre-processed data should be stored.  For now it is stored in the current working directory.
 #
 
+def tinyimages_op(s_idx):
+    """Return symbolic tiny_images[s_idx]
+
+    If s_idx is a scalar, the return value is a tensor3 of shape 32,32,3 and
+    dtype uint8.
+    If s_idx is a vector of len N, the return value
+    is a tensor4 of shape N,32,32,3 and dtype uint8.
+    """
+    op = TensorFnDataset('uint8',
+            bcast=(False, False, False),
+            fn=tinyimages.get_memmapped_file,
+            single_shape=(32,32,3))
+    return op(s_idx)
+
+
 _raw_patch_file = 'tinydataset_raw.npy'
 _pca_file       = 'tinydataset_pca.pkl'
 _whitened_file  = 'tinydataset_whitened.npy'