changeset 1470:94268a161925

memmap support in Dataset op
author James Bergstra <bergstrj@iro.umontreal.ca>
date Wed, 18 May 2011 10:50:21 -0400
parents 86bf03990aad
children 281efa9a4463
files pylearn/dataset_ops/protocol.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/dataset_ops/protocol.py	Wed Apr 06 13:53:00 2011 -0400
+++ b/pylearn/dataset_ops/protocol.py	Wed May 18 10:50:21 2011 -0400
@@ -3,6 +3,7 @@
 """
 
 __docformat__  = "restructuredtext_en"
+import numpy
 import theano
 
 class Dataset(theano.Op):
@@ -119,6 +120,6 @@
         except:
             x = self.x_ = self.fn(*self.fn_args)
         if idx.ndim == 0:
-            z[0] = x[int(idx)]
+            z[0] = numpy.asarray(x[int(idx)]) # asarray is important for memmaps
         else:
-            z[0] = x[idx]
+            z[0] = numpy.asarray(x[idx]) # asarray is important for memmaps