# HG changeset patch # User Olivier Delalleau # Date 1243015937 14400 # Node ID f308cc89360bc35e6b147af2cafd350fdc519c6b # Parent 0eae6d5315b59e69563ef1db3c20514539056edc Added a safety assert, just in case diff -r 0eae6d5315b5 -r f308cc89360b pylearn/algorithms/sandbox/DAA_inputs_groups.py --- 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):