changeset 1522:5972fab3cfd2

make ranzato_hinton_2010_op work with float64 for a DLT on mcrbm test.
author Frederic Bastien <nouiz@nouiz.org>
date Wed, 31 Oct 2012 16:19:51 -0400
parents 6397233f3ccd
children 0e0f9e8275a9
files pylearn/dataset_ops/image_patches.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/dataset_ops/image_patches.py	Wed Oct 31 16:12:57 2012 -0400
+++ b/pylearn/dataset_ops/image_patches.py	Wed Oct 31 16:19:51 2012 -0400
@@ -74,6 +74,11 @@
     dct = ranzato_hinton_2010(path)
     return dct['whitendata'].astype('float32')
 
+def ranzato_hinton_2010_whitened_patches_f64(path=None):
+    """Return the pca of the data, which is 10240 x 105
+    """
+    dct = ranzato_hinton_2010(path)
+    return dct['whitendata'].astype('float64')
 
 def undo_pca_filters_of_ranzato_hinton_2010(X, path=None):
     """Return tuple (R,G,B,None) of matrices for matrix `X` of filters (one per row)
@@ -110,7 +115,9 @@
         # rasterizing or not
         raise NotImplementedError('only pca data is provided')
 
-    if dtype != 'float32':
+    if dtype == "float64" and fn is ranzato_hinton_2010_whitened_patches:
+        fn = ranzato_hinton_2010_whitened_patches_f64
+    elif dtype != 'float32':
         raise NotImplementedError('dtype not float32')
 
     op = TensorFnDataset(dtype,