# HG changeset patch # User James Bergstra # Date 1301958072 14400 # Node ID 93e5ce7ccd6d5166890a077aaeba42622e60ecf4 # Parent 283fb236f10484eb68a277d936b6e3f2e54ca3dd tinyimages_op gains loop and shuffle kwargs diff -r 283fb236f104 -r 93e5ce7ccd6d pylearn/dataset_ops/tinyimages.py --- a/pylearn/dataset_ops/tinyimages.py Mon Apr 04 19:00:53 2011 -0400 +++ b/pylearn/dataset_ops/tinyimages.py Mon Apr 04 19:01:12 2011 -0400 @@ -34,7 +34,7 @@ # pre-processed data should be stored. For now it is stored in the current working directory. # -def tinyimages_op(s_idx): +def tinyimages_op(s_idx, loop=False, shuffled=False): """Return symbolic tiny_images[s_idx] If s_idx is a scalar, the return value is a tensor3 of shape 32,32,3 and @@ -42,9 +42,15 @@ If s_idx is a vector of len N, the return value is a tensor4 of shape N,32,32,3 and dtype uint8. """ + if loop: + s_idx = s_idx % tinyimages.n_images + if shuffled: + fn = tinyimages.get_memmapped_file + else: + fn = tinyimages.get_shuffled_memmapped_file op = TensorFnDataset('uint8', bcast=(False, False, False), - fn=tinyimages.get_memmapped_file, + fn=fn, single_shape=(32,32,3)) return op(s_idx)