changeset 758:c60ad32e1f40

Fix to the 'by_pair' corruption pattern
author Olivier Delalleau <delallea@iro>
date Tue, 02 Jun 2009 22:26:04 -0400
parents 2a30f22ef7ff
children 61a3608d5767
files pylearn/algorithms/sandbox/DAA_inputs_groups.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/algorithms/sandbox/DAA_inputs_groups.py	Tue Jun 02 14:40:43 2009 -0400
+++ b/pylearn/algorithms/sandbox/DAA_inputs_groups.py	Tue Jun 02 22:26:04 2009 -0400
@@ -316,11 +316,11 @@
             mask = self.random.binomial(T.shape(self.input), 1, 1 - self.noise_level)
         elif self.corruption_pattern == 'by_pair':
             shape = T.shape(self.input)
-            scale = numpy.ones(2)
-            scale[1] = 2
-            shape = shape / scale
+            # Do not ask me why, but just doing "/ 2" does not work (there is
+            # a bug in the optimizer).
+            shape = T.stack(shape[0], (shape[1] * 2) / 4)
             mask = self.random.binomial(shape, 1, 1 - self.noise_level)
-            mask = T.hstack((mask, mask))
+            mask = T.horizontal_stack(mask, mask)
         else:
             raise ValueError('Unknown value for corruption_pattern: %s'
                     % self.corruption_pattern)