changeset 712:f308cc89360b

Added a safety assert, just in case
author Olivier Delalleau <delallea@iro>
date Fri, 22 May 2009 14:12:17 -0400
parents 0eae6d5315b5
children a268c5ea0db4
files pylearn/algorithms/sandbox/DAA_inputs_groups.py
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/algorithms/sandbox/DAA_inputs_groups.py	Fri May 22 14:11:51 2009 -0400
+++ b/pylearn/algorithms/sandbox/DAA_inputs_groups.py	Fri May 22 14:12:17 2009 -0400
@@ -135,16 +135,17 @@
 		container.rec = self.hid_fn(container.rec_activation)
 		
 	def define_propup(self, container, input, idx_list, auxinput):
-		if not(self.input is None):
-			container.hidden_activation = self.filter_up(input,self.wenc,self.benc)
-			if not(self.auxinput is None):
+		if self.input is not None:
+            container.hidden_activation = self.filter_up(input, self.wenc,
+                    self.benc)
+			if self.auxinput is not None:
 				container.hidden_activation += scandotenc(idx_list,auxinput,self.wauxenc)
 		else:
-			if not(self.auxinput is None):
+			if self.auxinput is not None:
 				container.hidden_activation = scandotenc(idx_list,auxinput,self.wauxenc) + self.benc
 		
 	# DEPENDENCY: define_propup
-	def define_propdown(self, container, idx_list , auxinput):
+	def define_propdown(self, container, idx_list, auxinput):
 		if not(self.input is None):
 			rec_activation1 = self.filter_down(container.hidden,self.wdec,self.bdec)
 		if not(self.auxinput is None):
@@ -248,6 +249,8 @@
 			return self.reconstruction_cost_function(self.input, rec)
 		if not((self.input is None) or (self.auxinput is None)):
 			return self.reconstruction_cost_function(T.join(1,self.input,scaninputs(self.idx_list,self.auxinput)), rec)
+        # All cases should be covered above. If not, something is wrong!
+        assert False
 	
 	def _instance_initialize(self, obj, lr = 1 , reg_coef = 0, noise_level = 0 , noise_level_group = 0,
 							seed=1, alloc=True, **init):